问题
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