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 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...