1

I am using UIPickerViewController to capture photo, but I am getting layout as below:

enter image description here

As you can see in image - The Switch camera button is not showing properly.

Below is my code

    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    imagePickerController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
    imagePickerController.mediaTypes = @[(NSString *)kUTTypeImage];
    imagePickerController.sourceType = type;
    imagePickerController.delegate = self;
    imagePickerController.navigationBarHidden = YES;
    imagePickerController.cameraDevice = UIImagePickerControllerCameraDeviceFront;
    self.imagePickerController = imagePickerController;
    [self presentViewController:self.imagePickerController animated:YES completion:nil];

I am not sure what am I doing wrong, Please suggest

Thanks

NSSwift
  • 215
  • 2
  • 8
  • There's no need for this line imagePickerController.modalPresentationStyle = UIModalPresentationOverCurrentContext; When you remove this, has the issue gone? – Jim Tierney Jul 07 '15 at 13:15
  • nope, the issue still persists @JimTierney – NSSwift Jul 07 '15 at 13:16
  • @AngelVasa you might set the frame of imagePickercontroller , That is self.imagePickerController.frame = self.view.frame where is view is the view you want the image picker to fill [not tested] – iShaalan Jul 07 '15 at 13:46
  • imagePickerController.frame is not available :( @iShaalan – NSSwift Jul 07 '15 at 13:50
  • @AngelVasa I am sorry self. imagePickerController.view.frame – iShaalan Jul 07 '15 at 13:52
  • 1
    setting the frame also shows the full screen and with layout issue, actually after searching something I found "Apple recommends that you present the camera interface only full-screen" May be that is the reason why, setting the frame is not working for UIImagePickerViewController @iShaalan – NSSwift Jul 07 '15 at 14:00

2 Answers2

0

I had an issue where in iOS 7 my status bar was not being hidden. So here's what you need to do: First set view controller-based status bar appearance to NO, then add this code before presenting view controller:

[[UIApplication sharedApplication] setStatusBarHidden:YES];

Then just add 2 delegate methods:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
    [[UIApplication sharedApplication] setStatusBarHidden:NO];
}
Nikita Zernov
  • 5,465
  • 6
  • 39
  • 70
  • sorry but issue is not about hiding and showing status bar, The actual thing is the switch camera button is going outside of screen offset. (as you can see in image) and Thanks for your answer :) @NikitaZarnov – NSSwift Jul 07 '15 at 14:08
0

After trying many thing, I come to know that the issue is regarding Pixate Framework.

Pixate Issue

Thanks

NSSwift
  • 215
  • 2
  • 8