PresentModalViewController is shifted without animation

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 turned on, but I'm looking for an instant switch. The problem is that when I set the animation to NO, the whole view is shifted 20 pixels to the right (it is always in landscape mode), as if there is a status bar, but in portrait mode !?

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

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

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

+3
source share
1 answer

You must check the value of the property controller.view.frameand ensure that it is correct. Most likely, you will notice that the value origin.xis 20. However, I wonder why the frame is suitable for animation.

+2
source

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


All Articles