Landscape only iPad app displays UIImagePicker in portrait orientation - ios

I have an iPad app that only supports landscape orientations, however when I try to display a UIImagePickerController inside a UIPopoverController it always appears in portrait mode. i.e. rotated 90 degrees from the rest of the UI. Does anyone know how I can make this appear in the same orientation as the ViewController I'm presenting it in?
I'm displaying the imagePicker like this:
self.picker = [[FFSImagePicker alloc] init];
picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeImage];
picker.delegate = self;
picker.toolbarHidden = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.allowsEditing = NO;
picker.showsCameraControls = YES;
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
self.photoPickerPopover = popover;
[self.photoPickerPopover presentPopoverFromRect:photoButton.bounds inView:photoButton permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
FFSImagePicker is just a subclass of UIImagePickerController where I tried to make sure the supported orientations were only landscape, but that had no effect.
Thanks for any help...

OK, I solved this, the issue was that I was presenting the UIImagePickerController in a UIPopover which Apple says not to do when the source type is the camera, instead present it full screen just like you would any other view controller.
Hope this helps someone else too...

Related

How can change orientaiton of camera as orientation get changed of device in iPhone/ios/ipad?

I have tabbar as Root controller. When i choose camera from view controller then it opens in Portrait mode, and then i change its orientation but it still in portrait mode and when pickerview dismissed and again change main view controller to landscape mpde then all 5 tabbar items are shown on left side. So it looks like all tabbar items icons are get disturbed. Can any one help to change camera orientation when phone orientaiton gets changed?
if (self.pickerView) {
self.pickerView = nil;
}
self.pickerView = [[UIImagePickerController alloc] init];
self.pickerView.delegate = self;
self.pickerView.sourceType = UIImagePickerControllerSourceTypeCamera;
self.pickerView.showsCameraControls = YES;
self.pickerView.wantsFullScreenLayout = YES;
self.pickerView.navigationBarHidden = YES;
self.pickerView.toolbarHidden = FALSE;
self.pickerView.allowsEditing=YES;
[self presentViewController:self.pickerView animated:YES completion:NULL];

Front-facing / rear-facing camera button not showing in UIImagePickerController on iPad 2 iOS 7

I have an iPhone-only app. It allows users to capture videos using the default UIImagePickerController.
When you run the app on an iPad 2 running iOS 7, the UIImagePickerController does not show the "swap camera" button in the upper right-hand corner. This is the button that allows the user to switch between the front-facing and rear-facing cameras. I have no idea why the button is not there. The button is there on iPhone and on iPad 3. The problem only happens on iPad 2. See attached screenshot.
Weird behavior - if you rotate the iPad to landscape mode, and tap where the button is supposed to be, it actually switches to the front facing camera. So the functionality is there, but for some reason the button is not visible.
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMovie];
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
picker.allowsEditing = YES;
picker.videoMaximumDuration = 1800;
picker.videoQuality = UIImagePickerControllerQualityTypeMedium;
[self.navigationController presentViewController:picker animated:YES completion:nil];
[picker release];
Image here:
http://i.imgur.com/1IAeMU0.png
The UIImagePickerController only works on portrait, so you have to make a workaround to handle the orientation switch, like subclassing the UIImagePickerController, and changing the view when the orientation changes.
Credits: https://stackoverflow.com/a/21484101/736384

Camera controls not visible on iOS 7

I have used Image Picker Controller to call device camera. The code listed below works fine below iOS 7. But when I use the Same code on iOS 7 to launch camera I am unable see "Use" and "Cancel" buttons.
- (void)getCameraPicture {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
[self presentViewController:picker animated:YES completion:NULL];
}
Any help is appreciated.
Update:
When I try to run this code in a sample app then it works fine.(sample app contains single view). But when I put it inside my project the buttons doesn't show.
in the code should be there:
...
picker.showsCameraControls = YES;
have you checked this #property (nonatomic) BOOL showsCameraControls in UIImagePickerController.

UIImagePicker Popup in Portrait mode only In iPhone?

UIImagePicker opening in Portraite mode while my app is in ladscape mode.
code for UIimage picker is
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:nil];
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 that view to present additional information or manage the interactions between the camera interface and your code.
Reference from Apple docs

iPad landscape UIImagePickerController weird black rectangle

I have an iPad app that works only in landscape mode and everything works great. I have a problem when I try to launch the Photos Gallery in landscape... after reading all these posts it seems it is not possible. Let's assume that... I still try to display it, it goes nice into portrait, but I have a weird rectangle in the upper right corner that it shouldn't be there. Do you have any idea why is there or have you encountered something similar?
My code is the following:
[[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationPortrait animated:NO];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.modalPresentationStyle=UIModalPresentationPageSheet;
[self presentModalViewController: picker animated:YES];
[picker release];

Resources