swift - how to save several photos to array and CoreData -
at moment user can make photo or choose gallery. next time save array , core. how can make, user can make several photos , how store ? understand, can make several array , several button each foto, may more pretty way?
// save var imagearray: [journal] = [] let image = imageview.image let imagedata = nsdata(data: uiimagejpegrepresentation(image!, 1.0)!) journal.imagecore = imagedata (uiapplication.shared.delegate as! appdelegate).savecontext() // read let foto = self.image.viewwithtag(5000) as! uiimageview let data = uiimage(data:imagearray[lineforfulldetaillink].imagecore as! data) foto.image = data // uiimagepicker func chooseimagepickeraction(source: uiimagepickercontrollersourcetype) { if uiimagepickercontroller.issourcetypeavailable(source) { let imagepicker = uiimagepickercontroller() imagepicker.delegate = self imagepicker.allowsediting = true imagepicker.sourcetype = source self.present(imagepicker, animated: true, completion: nil) } }
Comments
Post a Comment