1

i need a UIImagePickerCOntroller, so that the User can take some photos. This is my Code:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{

    UIImagePickerController * imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePicker.delegate = self;
    imagePicker.showsCameraControls = YES;
    imagePicker.allowsEditing = YES;
    imagePicker.modalPresentationStyle = UIModalPresentationFullScreen;


    [self presentViewController:imagePicker animated:YES completion:nil];

}

For the first time i open the UIImagePickerController everything works fine! But for the Second, third... time i always get this:

enter image description here

As you can see the Camera Controls above gets cut. It looks like the StatusBar is the Problem. I tried everything like:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
   [[UIApplication sharedApplication] setStatusBarHidden:YES];
}

or

[[UIApplication sharedApplication] setStatusBarHidden:YES];

But nothing worked. Maybe an Apple Bug?

Davis
  • 1,253
  • 4
  • 17
  • 38

2 Answers2

0

Try this :

  • Go to Info.Plist
  • Set Status bar is initially hidden YES
  • Set View controller-based status bar appearance NO
Mayur Prajapati
  • 5,454
  • 7
  • 41
  • 70
0

Implement - (BOOL)prefersStatusBarHidden in your view controller and return YES or NO based on the current conditions. When you want to hide/show, call - (void)setNeedsStatusBarAppearanceUpdate on your view controller.

rounak
  • 9,217
  • 3
  • 42
  • 59