I’m now struggling with UIImagePicker.
I’ve read the document but it seems not to mention how should I save a newly token photo, I mean save it into my own documents in my app.
In fact, there is a “photo” attribute in one of my entity in core data,
so, the “photo” should just be a NSString to save the real photo’s file path, right?
But how to save that photo and get its correct file path?
I just know little about NSFilePath or something like that, hope someone to teach me a little bit.
Thanks a lot!
You may know how to present the image picker:
With the above the viewController implements the UIImagePickerControllerDelegate and make sure you implement this function:
and
The first method is called when user has picked a photo. In this method you get the image using:
To write this to a file you can make it a JPEG or a PNG. If a JPEG you may do this:
You just need to set the filename.
To get the image back into a UIImage you do this: