1

Following this advice on how to set the status bar unhidden after UIImagePicker hides it. (How has this not been fixed by now?)

I'm using GKImagePicker which adds an extensible cropping interface. It's used the same way as an image picker controller, setting yourself as the delegate and then presenting the controller modally.

I figured the best place to put the status bar workaround was its delegate methods, like so:

- (void)imagePicker:(GKImagePicker *)imagePicker pickedImage:(UIImage *)image
{
    [self.imagePicker.imagePickerController dismissViewControllerAnimated:YES
                                                               completion:^{
        self.imageView.image = image;

        // Workaround for UIImagePickerController hidden status bar bug
        [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];

    }];
}

- (void)imagePickerDidCancel:(GKImagePicker *)imagePicker
{
    [self.imagePicker.imagePickerController dismissViewControllerAnimated:YES
                                                               completion:nil];

    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
}

On cancellation, everything works well and the status bar happily slides into place. When picking an image though, the status bar comes bar overlays my navigation bar, and the navigation bar's top corner is drawn at (0,0). What gives?

Community
  • 1
  • 1
user
  • 3,388
  • 7
  • 33
  • 67
  • 1
    Note that `setStatusBarHidden:` works normally in `viewWillAppear:` – user Sep 09 '13 at 03:43
  • I'm guessing it has to do with dismissViewController calling to the parent view controller to redraw he screen because placing it above the dismiss statement also works. But it's still strange that one methods dismissViewController acted differently. I suppose that could be because the cancel method never unloads the parent view or something? – user Sep 09 '13 at 03:50
  • 3
    I haven't played with that code in a while and GKImagePicker was pretty broken last time I tried to use it, but looking back on it, I just put the `setStatusBarHidden:NO` call in `viewWillAppear`. – user Feb 16 '14 at 21:03

0 Answers0