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

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

PresentViewController from custom TableCell in xib

TableViewCell is a view, you can not present on views instead UIViewController can handle it. You should transfer the control from your cell to your controller that holds tableview and creates custom cell for it. Try like this: Custom Cell .h Class: @protocol changePictureProtocol <NSObject> -(void)loadNewScreen:(UIViewController *)controller; @end @property (nonatomic, retain) id<changePictureProtocol> delegate; Then Synthesize … Read more

Using UIImagePickerController in landscape orientation

If you’d like to use UIImagePickerController in landscape mode, use user1673099’s answer, but instead of: – (BOOL)shouldAutorotate { return NO; } use: – (UIInterfaceOrientationMask)supportedInterfaceOrientations{ return UIInterfaceOrientationMaskLandscape; } and then the picker would open in landscape mode: But make sure you check Portrait in deployment info:

Set dimensions for UIImagePickerController “move and scale” cropbox

Not possible with UIImagePickerController unfortunately. The solution I recommend is to disable editing for the image picker and handle it yourself. For instance, I put the image in a scrollable, zoomable image view. On top of the image view is a fixed position “crop guide view” that draws the crop indicator the user sees. Assuming … Read more

Force landscape orientation in UIImagePickerController

As per the UIImagePickerController Class Reference Important: The UIImagePickerController class supports portrait mode only. This class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified, with one exception. You can assign a custom view to the cameraOverlayView property and use … Read more

Select Multiple Images (UIImagePickerController or Photos.app Share UI)

If you are supporting only iOS 14 and up, you can use Apple’s PHPickerViewController. It allows multiple image selection (while UIImagePickerController does not). An additional benefit to using PHPickerViewController vs other libraries listed above is that the user will not need to grant permission to access your photo library.

tech