UIImagePickerController (sourceTypeCamera) does not fill the top screen / status bar

I call UIImagePickerController (sourceTypeCamera) as modalViewController from my MainViewController. However, the UIImagePickerController does not fill the screen at the top, as the attached image shows. UIImagePickerController strange behavior Any idea what could be causing this, and how to fix it?

+6
source share
7 answers

After many attempts, I found that calling presentViewController from the [[[[UIApplication sharedApplication] delegate] window] rootViewController] solved the problem.

+4
source

Some code will be helpful.

If necessary, try setting the bounds property instead of the frame property.

+1
source

In my application in the viewcontroller, which is inside the navigationController - I do this:

 UIImagePickerController* imagePickerController_; imagePickerController_.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentModalViewController:imagePickerController_ animated:YES]; 

and

 @interface CustomViewController : UIViewController <UIImagePickerControllerDelegate> 

It works without problems. If you still have problems, can you share some code? What navigation structure does your application have (tabbarcontroller, navigationcontroller, ...?) ?, how do you imagine the image manager?

+1
source

There is a boolean value on the UIViewController that you might wantsFullScreenLayout useful: wantsFullScreenLayout . According to the docs, this is:

A boolean value indicating whether the view should overlap the status bar.

I had several problems, especially on iOS 5, with views hiding the status bar, especially when they are presented modally. The best I have found is to set this value to YES and manually lay out my view under the status bar. FYI, the status bar has a height of 20.

+1
source

You need to change the framePickerController property. when initializing Ie

imagePickerController.view.frame.origin.y = 20;

0
source

Call

 [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; 

Before calling

 [self presentModalViewController:picker animated:YES] 
0
source
 UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera; [self.view addSubview:imagePicker.view]; [imagePicker viewWillAppear:YES]; [imagePicker viewDidAppear:YES]; [[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO]; 
-1
source

Source: https://habr.com/ru/post/918095/


All Articles