Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using setSourceType with image picker up hides status bar

Tags:

iphone

I am pretty sure this is a bug but I thought I would check. I used the camera overlay to add a button so that on the iphone a user can switch from the camera view to the photo library. When button is taped the source type switches fine but the status bar is missing from the photo library. Throughout the rest of that session the status bar remains missing from all views evet thougth isStatusBarHidden reports NO.

This is how the camera overlay view is created

if (cameraOverlayView == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"CameraOverlayView" owner:self options:nil];
}

If camera is available this is when I set source type and add overlay

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
    [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
    [imagePicker setCameraOverlayView:cameraOverlayView];
}

Here is the action statement to change source type.

  • (IBAction)selectImage; { [imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; }

If I don't tap the button on the overlay there is no problem with the status bar.

PS. I did submit a bug report on this.

like image 312
Aaron Avatar asked Dec 04 '25 15:12

Aaron


1 Answers

I solved this problem by explicitly hiding and then showing the status bar:

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
like image 125
Brian L Avatar answered Dec 07 '25 04:12

Brian L



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!