PresentModalViewController视图移动时没有动画 [英] PresentModalViewController view is shifted with no animation

查看:68
本文介绍了PresentModalViewController视图移动时没有动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone上有一个新的视图控制器,我使用以下代码行对其进行调用:

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

[self presentModalViewController:controller animated:NO];

如果启用了动画,这效果很好,但是我希望有一个即时开关.问题是当我将动画设置为否"时,整个视图向右移动20px(始终处于横向模式),就像有一个状态栏但处于纵向模式一样!?

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.

替代文字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

推荐答案

您应该检查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 the origin.x value is 20. However, I'm perplexed as to why the frame fits when animated.

这篇关于PresentModalViewController视图移动时没有动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆