rotation – 支持tabbarcontroller iOS 6中morenavigationcontroller和children viewcontroller中的所有方向

前端之家收集整理的这篇文章主要介绍了rotation – 支持tabbarcontroller iOS 6中morenavigationcontroller和children viewcontroller中的所有方向前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个tabbar应用程序.我通过将标签栏控制器设置为窗口根视图控制器,然后通过子类别覆盖navigationcontroller和tabbacontroller的行为来修改标签的方向(虽然不推荐).
 现在,除了更多导航控制器及其子视图控制器之外,所有选项卡都可以使用方向.我知道问题是设备旋转通知没有传递给Tab栏控制器中morenavigationcontroller里面的子视图控制器.
此外,更多的navigationcontroller是readonly属性.

我的问题是我想在morenavigationcontroller和子视图控制器中支持所有方向.现在shoulautorotate内部的子视图控制器没有被调用更多导航控制器.

解决方法

在iOS 6之后,Apple改变了应用程序中的方向.请看下面的帖子.这是非常有帮助的

Tabbar controller with navigationcontrollers orientation ios 6

或者,您可以创建自定义tabbarcontroller并实现以下方法

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // You do not need this method if you are not supporting earlier iOS Versions
    return [self.selectedViewController shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}

-(NSUInteger)supportedInterfaceOrientations
{
    return [self.selectedViewController supportedInterfaceOrientations];
}

-(BOOL)shouldAutorotate
{
    return YES;
}

猜你在找的iOS相关文章