PresentModalViewController view is shifted with no animation

元气小坏坏 提交于 2020-01-02 08:09:20

问题


I have a new view controller on the iPhone which I call using the following line of code:

[self presentModalViewController:controller animated:NO];

This works great if animation is on, but I am looking to have an instant switch. The problem is when I set animation to NO, the whole view shifts 20px to the right (it is always in landscape mode) as if there is a status bar but in portrait mode!?

In this example the yellow space is the new view controller.

alt text http://www.james-ingham.info/pics/iphoneshift.png

I've tried this in a new project and the same thing happens. It may be a bug but does anyone have a fix? Thanks


回答1:


You should check the value of the controller.view.frame property, and make sure that it is correct. Most likely you will notice that the origin.x value is 20. However, I'm perplexed as to why the frame fits when animated.



来源:https://stackoverflow.com/questions/2838450/presentmodalviewcontroller-view-is-shifted-with-no-animation

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