shouldAutoRotate方法不能正常工作..?

时间:2010-08-26 08:08:04

标签: iphone objective-c ipad

我在基于拆分视图的ipad应用程序中使用了多个uiviewcontrollers。 有网络服务。对于某些特定的Web服务(例如Logout),我需要删除split 查看并插入新视图,即登录屏幕。但大多数时候,应该调用Login视图的AutoRotate方法,导致不旋转的哑应用程序。         这背后可能是什么原因?我该怎么办?

3 个答案:

答案 0 :(得分:1)

维护我的遗留代码我添加了这个。

- (BOOL)shouldAutorotate{
    UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
    if (orientation == UIDeviceOrientationUnknown) return YES;
    BOOL result = [self shouldAutorotateToInterfaceOrientation:orientation];
    return result;
}

然后原始代码返回有效的自动旋转信息。

答案 1 :(得分:0)

确保所有视图控制器为{2}版本的YES返回shouldAutorotateToInterfaceOrientation: - 至少是那时可见的视图。

请参阅:iPad orientation change issue

答案 2 :(得分:0)

确保你没有从你的UIViewController中提取UIView,其中shouldAutorotateToInterfaceOrientation:函数返回YES,然后将UIView添加到另一个UIView中使用addSubView。我之前遇到过。