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?
Asked
Active
Viewed 363 times
0

Arpana Sakpal
- 23
- 7
-
Do you want to show status bar on the Camera and UIImagePicker View's ? – Sneha Dec 21 '16 at 09:16
-
@arpana sakpal what you want ? – Himanshu Moradiya Dec 21 '16 at 09:19
-
I think this [Hide Status Bar](http://stackoverflow.com/questions/19018391/hide-status-bar-from-iphone-application) link will helps in your case. – amit_donga Dec 21 '16 at 09:21
-
I just want to show status bar on UIimagepicker ViewController – Arpana Sakpal Dec 21 '16 at 09:43
-
Hide status bar works for other all view controllers only when uiview controller navigating to camera its hiding status bar for a while which reappears later after image picker did finish. – Arpana Sakpal Dec 21 '16 at 09:45
-
@ArpanaSakpal When you open camera using UIImagePickerController,iOS SDK does'n allowed to status bar.if you want to show stausbar than you follow this [link](https://github.com/rFlex/SCRecorder) – Himanshu Patel Dec 21 '16 at 12:47
2 Answers
1
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

Arpana Sakpal
- 23
- 7
0
-(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.

Paul.V
- 386
- 1
- 3
- 13