PresentModalViewController 视图在没有动画的情况下移动
我在 iPhone 上有一个新的视图控制器,我使用以下代码行调用它:
[self presentModalViewController:controller animated:NO];
如果动画打开,这效果很好,但我希望有一个即时切换。问题是当我将动画设置为“否”时,整个视图向右移动 20px(始终处于横向模式),就好像有一个状态栏但处于纵向模式一样!?
在此示例中,黄色空间是新的视图控制器。
替代文本 http://www.james-ingham.info/pics/iphoneshift.png< /a>
我在一个新项目中尝试过这个,并且发生了同样的事情。这可能是一个错误,但有人有解决办法吗?谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该检查
controller.view.frame
属性的值,并确保它是正确的。您很可能会注意到origin.x
值为 20。但是,我很困惑为什么框架在动画时适合。You should check the value of the
controller.view.frame
property, and make sure that it is correct. Most likely you will notice that theorigin.x
value is 20. However, I'm perplexed as to why the frame fits when animated.