UIImagePickerController presentViewController - status bar in ios7

I ran into a status issue in iOS 7. enter image description here

Below is the code to represent this collection of images

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {

        picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;

        if ([self respondsToSelector:@selector(presentViewController:animated:completion:)]){
            [self presentViewController:picker animated:YES completion:^{

                if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
                    [[UIApplication sharedApplication] setStatusBarHidden:YES
                                                            withAnimation:UIStatusBarAnimationNone];
            }];
        }
        else {
            [self presentModalViewController:picker animated:YES];
        }
    }

and when I try to select an image, the screen looks below

enter image description here

Can someone help me solve this problem?

+4
source share
1 answer

try it

- (void)imagePickerController:(UIImagePickerController *)aPicker didFinishPickingMediaWithInfo:(NSDictionary *)info {

// for iOS7
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {

    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}

Edit:

here is a lot easier.

add a logical display of the status of the logical state in the control panel in your plist and set its value to NO. then in the application deletion application didFinishLaunchingWithOptionsdeclare the following:

[application setStatusBarHidden:NO];
[application setStatusBarStyle:UIStatusBarStyleDefault];

. , UIImagePickerController

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

, .

, .

+6

All Articles