How to make UIImagePickerController StatusBar lightContent style?

前端 未结 7 1682
悲哀的现实
悲哀的现实 2020-12-29 12:53

\"enter

When I present the ImagePickerController the statusBar text color is still bla

7条回答
  •  忘掉有多难
    2020-12-29 13:28

    I had the same problem having to manage the application runned under different iOS versions.

    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    
    if(IS_IOS8_AND_UP) {
        imagePickerController.modalPresentationStyle = UIModalPresentationFullScreen;
    } else {
        imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
    }
    
    imagePickerController.delegate = self;
    [self presentViewController:imagePickerController animated:YES completion:nil];
    

    The, in delegate:

    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
        /* Cancel button color  */
        _imagePicker.navigationBar.tintColor = 
        /* Status bar color */
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    }
    

提交回复
热议问题