当我模态显示uiimagepickerviewcontroller时,我在应用程序中隐藏状态栏。
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
在回调方法中:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
我执行以下方法:
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
致电之前:
[picker dismissViewControllerAnimated:YES completion:^() {}];
我尝试在完成块中“显示”状态栏无济于事。关闭uiimagepickerviewcontroller后,如何使状态栏重新出现?
最佳答案
尝试将其放回视图控制器解雇完成处理程序中:
[picker dismissViewControllerAnimated:YES completion:^(BOOL done){
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES];
}];
尽管这很奇怪,但没有任何理由说明为什么这种方法无法奏效。