iOS 6倒转为纵向对UITableViewController不起作用,iOS 5可以
我有一个应用程序,支持所有四个方向,在iOS 5上运行良好 但是,在iOS 6上,我的所有UIViewController类都可以正确旋转,但我的UITableViewController类不会向上向下旋转 应用程序支持的方向包括所有四个选项 AppDelegate支持所有方向:iOS 6倒转为纵向对UITableViewController不起作用,iOS 5可以,ios,ios6,uitableview,uiinterfaceorientation,Ios,Ios6,Uitableview,Uiinterfaceorientation,我有一个应用程序,支持所有四个方向,在iOS 5上运行良好 但是,在iOS 6上,我的所有UIViewController类都可以正确旋转,但我的UITableViewController类不会向上向下旋转 应用程序支持的方向包括所有四个选项 AppDelegate支持所有方向: - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)wi
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
//return (UIInterfaceOrientationMaskAll);
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
所有my view类都实现了必要的方法,包括iOS 6引入的方法:
- (NSUInteger)supportedInterfaceOrientations
{
//return (UIInterfaceOrientationMaskAll);
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
- (BOOL)shouldAutorotate
{
BOOL bReturn = [self shouldAutorotateToInterfaceOrientation:self.interfaceOrientation];
return (bReturn);
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (YES);
}
我能找到的唯一区别是视图的显示方式
UIViewController
UITableViewController
不完全确定实现会对轮换产生什么影响,更不确定如何处理
任何指导都将不胜感激。基于我上面的评论,我创建了一个新类,该类继承自UINavigationController,并添加了识别支持方向的方法
- (NSUInteger)supportedInterfaceOrientations
{
//return (UIInterfaceOrientationMaskAll);
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
然后,当我需要为UITableViewController呈现ModalViewController时,我创建了一个新RotationNavigationController类的对象
似乎已经解决了我的所有问题。基于我上面的评论,我创建了一个新类,该类继承自UINavigationController,并添加了用于标识支持方向的方法
- (NSUInteger)supportedInterfaceOrientations
{
//return (UIInterfaceOrientationMaskAll);
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown);
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
return UIInterfaceOrientationMask(rawValue: UIInterfaceOrientationMask.Portrait.rawValue | UIInterfaceOrientationMask.PortraitUpsideDown.rawValue)
} else {
return .All
}
}
然后,当我需要为UITableViewController呈现ModalViewController时,我创建了一个新RotationNavigationController类的对象
似乎已经解决了我的所有问题。Hmmm,我刚刚想到我正在演示一个UINavigationController,而不是MenuViewController对象。不确定这是否是实际问题,也不确定如何将受支持的方向与UINavigationController对象关联。Hmmm,我突然想到我正在演示一个UINavigationController,而不是MenuViewController对象。不确定这是否是实际问题,或者如何将支持的方向与UINavigationController对象关联。这是一个非常节省时间的答案。它确实有效。我有这个问题好几天了。非常感谢您与我们分享您的答案。这是一个非常节省时间的答案。它确实有效。我有这个问题好几天了。非常感谢您与我们分享您的答案。
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
return UIInterfaceOrientationMask(rawValue: UIInterfaceOrientationMask.Portrait.rawValue | UIInterfaceOrientationMask.PortraitUpsideDown.rawValue)
} else {
return .All
}
}