Why does setting the status bar unhidden put the status bar above my navigation bar?

360 Views Asked by At

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?

0

There are 0 best solutions below