Status bar gets hidden when picking up image imagepicker

391 Views Asked by At

My requirement for the app is to show status bar through out the app.On certain Viewcontroller I am calling Image picker. on click on buttonImage, When current viewcontroller disappears and camera appears, status bar gets hidden that actually shifts navigation bar slightly upwards. the status bar and navigation bar resumes after completion of image pickup.
How can I keep status bar unaffected?

2

There are 2 best solutions below

0
On

May not be correct way to do it but after trying many answers, I just cancelled the animation of push Viewcontroller. I did in this way

UIImagePickerController *picker=[[UIImagePickerController alloc]init];
    picker.delegate=self;
    picker.allowsEditing=YES;
    picker.sourceType=UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:picker animated:NO completion:NULL];

in (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{ [self dismissViewControllerAnimated:NO completion:nil];}

this just hides the status bar shifting

0
On

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

Please right down this code in your respective class as UIImagePickerController dismiss will call this function and your status bar will not dissappear anymore.