iPhone – UIImagePickerControllerDelegate inheritance

As you noted, UIImagePickerController inherits from UINavigationController. It uses the same delegate property though and doesn’t declare a (hypothetical) “imagePickerDelegate” of its own, so your delegate has to conform to both protocols. It makes sense, because you’re also assigning the same delegate to the UINavigationController part (that knows nothing about the image picker). The API … Read more

iOS7 iPad Landscape only app, using UIImagePickerController

If your iPad app is landscape only in all conditions, just do these 3 steps : 1) In your app delegate – (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { return UIInterfaceOrientationMaskAll; } 2) Create a category header #import “UIViewController+OrientationFix.h” @implementation UIViewController (OrientationFix) – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return UIInterfaceOrientationIsLandscape(toInterfaceOrientation); } – (BOOL)shouldAutorotate { return YES; } – (NSUInteger)supportedInterfaceOrientations { … Read more

UIImage Saving image with file name on the iPhone

Kenny, you had the answer! For illustration I always think code is more helpful. //I do this in the didFinishPickingImage:(UIImage *)img method NSData* imageData = UIImageJPEGRepresentation(img, 1.0); //save to the default 100Apple(Camera Roll) folder. [imageData writeToFile:@”/private/var/mobile/Media/DCIM/100APPLE/customImageFilename.jpg” atomically:NO];

How to allow user to pick the image with Swift?

If you just want let the user choose image with UIImagePickerController use this code: import UIKit class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate { @IBOutlet var imageView: UIImageView! @IBOutlet var chooseBuuton: UIButton! var imagePicker = UIImagePickerController() @IBAction func btnClicked() { if UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum){ print(“Button capture”) imagePicker.delegate = self imagePicker.sourceType = .savedPhotosAlbum imagePicker.allowsEditing = false present(imagePicker, animated: true, completion: … Read more