iPad iOS7 - UIImagePickerController in UIPopoverController has wrong preview image
The UIImagePickerController has a property called cameraViewTransform. Applying a CGAffineTransform to this will transform the preview image but will not transform the captured image which will therefore be correctly captured. I have the same problem that you describe and I solved it (for iOS7) by creating my camera controller and placing it in a popover as follows:
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
[imagePickerController setDelegate:self];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
CGFloat scaleFactor=1.3f;
switch ([UIApplication sharedApplication].statusBarOrientation) {
case UIInterfaceOrientationLandscapeLeft:
imagePickerController.cameraViewTransform = CGAffineTransformScale(CGAffineTransformMakeRotation(M_PI * 90 / 180.0), scaleFactor, scaleFactor);
break;
case UIInterfaceOrientationLandscapeRight:
imagePickerController.cameraViewTransform = CGAffineTransformScale(CGAffineTransformMakeRotation(M_PI * -90 / 180.0), scaleFactor, scaleFactor);
break;
case UIInterfaceOrientationPortraitUpsideDown:
imagePickerController.cameraViewTransform = CGAffineTransformMakeRotation(M_PI * 180 / 180.0);
break;
default:
break;
}
__popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[__popoverController presentPopoverFromRect:presentationRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
I also scale the image when in Landscape so that it fills the viewfinder more than it otherwise would. To my mind this is all rather nasty, but I will hopefully be able to remove it once iOS7.1 arrives.
ios 7 image picker inside popover wrong behavior
As the Apple's Official Doc said:
Present the user interface. On iPhone or iPod touch, do this modally (full-screen) by calling the presentViewController:animated:completion: method of the currently active view controller, passing your configured image picker controller as the new view controller.
On iPad, the correct way to present an image picker depend on its source type, as summarized in this table:
- Camera Photo: Use full screen
- Library Saved: Must use a popover
- Photos Album: Must use a popover
...
On iPad, if you specify a source type of UIImagePickerControllerSourceTypeCamera, you can present the image picker modally (full-screen) or by using a popover. However, Apple recommends that you present the camera interface only full-screen.
Though it said "you can present the image picker modally (full-screen) or by using a popover", as you see by using a popover will result with this weird issue. I guess this might be a bug on iOS 7 SDK.
I'm still trying to fix this issue, but for now, the only way I can tell is to show it modally by
-presentViewController:animated:completion:
method, which is in full-screen (Actually, I don't like this way).
And there's a THREAD discussed about it on Apple's Dev Forums, you can take a look at it. ;)
ipad UIImagePickerController different size on preview and on take pic Landscape
I see 2 differences in your sample images: size and a horizontal flip.
The size difference could be because you are setting picker.modalPresentationStyle = UIModalPresentationFullScreen;
but then you are displaying it in a smaller popover.
I would try and present the picker without a popover and see if it works.
Also, the preview image looks a bit distorted. If you are using Scale To Fill as contentMode for the imageView then I would change it to Aspect Fill.
I don't know where the horizontal flip might come from.
iPad camera popover preview wrong rotation and scale
Turns out to be an issue with the way iOS 6.0 deals with rotation - its fixed in 6.1
UIImagePickerController via UIPopoverController
As another option, you could use the popover's setContentViewController:
or setContentViewController:animated:
to change to the UIImagePickerController and then change back to your own view controller.
UIImagePickerController in UIPopoverController is showing as blank white view
Also you should specify UIImagePicker's sourceType.
_picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
UPDATE
Initialise picker this way:
_picker = [[UIImagePickerController alloc] init];
Related Topics
How to Implement Localization in Swift Ui
Xcode 11.4. Navigation's Title Color Gone Black from Storyboard
iOS Uicollectionview - Default Flow, Fill Rows from Right to Left
Uicollectionview Multiple Sections and Headers
Move Xcode Project Causes Red Text (Missing Files from Project)
Swift: Natively Detect If App Has Crashed
How to Disable User Interaction on Mkmapview
Static Linking with Swift, Xcode6-Beta
Automating Xcode' Debug > Simulate Location Command
Can't Set Background Color of Uitableviewcell in Ib
Swift: Save Video from Nsurl to User Camera Roll
What Is the Impact of the "Requires Full Screen" Option in Xcode for an Iphone-Only App
Workaround for Rounded Corners of Grouped Uitableview, iOS7
Pop the Current View Using Segues/Storyboard on iOS 5
Xcode 6.4/7 Crashing After El Capitan Beta
Easiest Way of Getting Reverse Geocoded Current Location from iOS
Opening Word,Excel, and PDF Files Without Using Uiwebview on iOS