【问题标题】:Landscape animation bug when popping view controller in iPhone app在 iPhone 应用程序中弹出视图控制器时出现横向动画错误
【发布时间】:2009-08-05 23:39:18
【问题描述】:
我最近在我的基于 iPhone 导航的应用程序中添加了横向自动旋转,但是我遇到了一个奇怪的问题,我不知道如何解决,也不知道我的代码是否甚至是 cuplrit。这很奇怪,因为我正在按照 Apple 开发人员中心上的自动旋转文档实现所有内容(即响应 shouldAutorotateToBlaBla 并确保我的视图自动调整正确)。
问题在于,在推动视图控制器动画时正确,弹出它们会导致动画有时移动 20 像素然后在屏幕上设置动画,而不是相对于当前旋转从右到左。
换句话说,当您在横向视图控制器中点击返回时,它不会在屏幕右侧显示动画,而是垂直向下动画,就好像它处于纵向方向一样。
有什么线索吗?
【问题讨论】:
标签:
iphone
view
navigation
controller
【解决方案1】:
我有这个错误,但通过在我拥有的 每个 视图控制器中实现这个 UIViewController 方法来修复它。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return interfaceOrientation == UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}