拾取图像imagepicker时状态栏会隐藏

时间:2016-12-21 09:11:54

标签: ios objective-c uiimagepickercontroller statusbar

我对该应用程序的要求是通过app显示状态栏。在某个Viewcontroller上我正在调用Image picker。点击buttonImage,当当前的viewcontroller消失并且相机出现时,状态栏会被隐藏,实际上会略微向上移动导航栏。完成图像拾取后,状态栏和导航栏将恢复 如何保持状态栏不受影响?

2 个答案:

答案 0 :(得分:0)

可能不是正确的方法,但在尝试了很多答案后,我刚刚取消了推送Viewcontroller的动画。我这样做了

UIImagePickerController *picker=[[UIImagePickerController alloc]init];
    picker.delegate=self;
    picker.allowsEditing=YES;
    picker.sourceType=UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:picker animated:NO completion:NULL];
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{ [self dismissViewControllerAnimated:NO completion:nil];}

中的

这只是隐藏状态栏转移

答案 1 :(得分:0)

-(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [[UIApplication sharedApplication] setStatusBarHidden:NO]; }

请在您的相应课程中右键下载此代码,因为UIImagePickerController dismiss将调用此函数,您的状态栏将不再消失。