The above are useful, but they do not answer your question about how to save in a subdirectory or get an image from UIImagePicker.
First, you must indicate that your controller implements the image selection delegate in the .m or .h file, for example:
@interface CameraViewController () <UIImagePickerControllerDelegate> @end
Then you implement the imagePickerController delegate: didFinishPickingMediaWithInfo method: where you can get the photo using the image picker and save it (of course, you may have another class / object that handles the save, but I just show the code inside the method):
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
If you want to save the image in JPEG format, the last 3 lines will be as follows:
NSString *filePath = [imageSubdirectory stringByAppendingPathComponent:@"MyImageName.jpg"];
Alex the Ukrainian Oct 02 '13 at 23:48
source share