ipad - 无法在 iOS 6 中处理方向?

标签 ipad uiinterfaceorientation ios6 autoresizingmask iphone-5

我在用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
委托(delegate)根据方向类型更改我的 View 框架

IE。,

if(UIInterfaceOrientationIsLandscape(interfaceOrientation))
{
    self.view.frame=CGRectMake(0,0,500,300);
}
else
{
    self.view.frame=CGRectMake(0,0,300,400);
}

如何在 iOS 6 中处理与
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

在 iOS6 中已被弃用。

我正在使用以下委托(delegate)来设置所有方向。
-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationAllMask;
}

但,
-(BOOL)shouldAutoRotate
{
    return YES;

}

没有被调用。如何处理这种情况?

enter image description here

最佳答案

在 AppDelegate 中,我已将 ViewController 对象添加到窗口中
[self.window addSubView:viewControllerObj]
问题出在上面的行上。在 iOS 5 中,方向将与上述行正常工作,但在 iOS 中,要使方向正常工作,请将上述行更改为
[self.window setRootViewController:viewControllerObj]
然后当方向改变时应用程序会旋转。

关于ipad - 无法在 iOS 6 中处理方向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12519693/

相关文章:

ios - UIPrintInteractionController 不显示本地化文本

ios - 核心数据不保存我的数据

ios - UIView 适用于 iPhone 4in,但在 iPhone 3.5in 中被压扁

iphone - UIViewController Containment - 新 child 不知道旋转

ios - iOS 7 中 Notes 应用程序的字体效果

iphone - iOS 无法旋转

ios - 方向更改时以编程方式更改 UISearchBar 的框架

ios - 适当的 AutoresizingMask

ios - caretRectForPosition 的默认值是什么或如何设置确定类覆盖的 BOOL

ipad - MPMoviePlayerViewController 隐藏状态栏