iPhone - ModalViewController not raising to top of the screen

筅森魡賤 提交于 2019-12-11 05:26:29

问题


I have a UIImagePickerController that is shown

[self presentModalViewController:self.picker animated:NO];

Then later on the code, I allow the user to display a preference panel :

PreferencesController *nextWindow = [[[PreferencesController alloc] initWithNibName:@"Preferences" bundle:nil] autorelease];
UINavigationController* navController = [[[UINavigationController alloc] initWithRootViewController:nextWindow] autorelease];
[self presentModalViewController:navController animated:YES];

At this point, the new controller raises on the screen, but don't go to the top. Some space is left "transparent" at the top (I can see the camera view behind), and the bottom of the view is hidden out of the screen. The space I am talking about is about a status bar height. The status bar is not present on the screen.

The navigation controller is hidden :

self.navigationController.navigationBarHidden = YES;

There is a toolbar at the top of the view. Nothing special into the view. The height of the view is defined at 480. All simulated element are set off in IB. The autoresize properties are all set on.

I had a previous xib (I rebuilt it from scratch) that worked very well. I don't see what I missed on this one (I have only changed the xib, that replaces the previous one).

I've cleaned the cache to be sure there was nothing left. No change... I've deleted everything in the new view to prevent some conflicts. No change...

What did I miss ? How could I remove this empty space ?


回答1:


Try presenting the second modal view controller (the preferences one) from self instead of self.picker

ModalViewController loading on top of another Modal

Edit:

Try setting wantsFullScreenLayout = YES




回答2:


After some searches and some other problems, I've found a final solution to the problem through this question

I had to call :

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

at the application start.



来源:https://stackoverflow.com/questions/5333120/iphone-modalviewcontroller-not-raising-to-top-of-the-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!