iOS8 方向 : supportedInterfaceOrientations called but no orientation change

标签 ios iphone ios8 orientation

我有一个导航 Controller :

    //=========================
    - (BOOL)shouldAutorotate;
    {
        return YES;
    }

    - (NSUInteger)supportedInterfaceOrientations
    {
        NSLog(@"Nav: supported Orientation");     
        if ([[self topViewController] respondsToSelector:@selector(supportedInterfaceOrientations)])

       else
          return [super supportedInterfaceOrientations];
    }

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
    {
        [self.topViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation];
    }

    -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
        [self.topViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
    }

我的 ROOTCTRL 有:

//=========================
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscape;
}

-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}

-(BOOL)shouldAutorotate
{
    return YES;
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
    NSString *risp;
    switch (self.interfaceOrientation) {
        case UIInterfaceOrientationLandscapeLeft:
            risp = @"LAND_LEFT";
            break;
        case UIInterfaceOrientationLandscapeRight:
            risp = @"LAND_RIGHT";
            break;
        case UIInterfaceOrientationPortrait:
            risp = @"PORT";
            break;
        case UIInterfaceOrientationPortraitUpsideDown:
            risp = @"PORT_UPsideDOWN";
            break;
        case UIInterfaceOrientationUnknown:
            risp = @"UNKNOW";
            break;
        default:
            break;
    }
    NSLog(@"HOME didRotate:%@",risp);
}

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{

}
UINavigationController的

supportedInterfaceOrientations总是被调用,Home Controller 的supportedInterfaceOrientations也总是被调用;但主页不会从横向左旋转到横向右,反之亦然:

因此,Home ctrl 在启动时具有正确的方向,但如果设备旋转了 Home Controller ,则永远不会旋转...它仅调用supportedInterfaceOrientations 方法(导航 Controller 和根 Controller ),没有任何效果...

我做错了什么??

最佳答案

如果在 iOS8 上运行并且您的代码在 iOS8 之前就已经存在,请检查以下答案。删除您的应用委托(delegate)中提到的行(如果它存在并且应该开始工作)。

UISplitViewController rotation iOS8 not working as expected

关于iOS8 方向 : supportedInterfaceOrientations called but no orientation change,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28498473/

相关文章:

ios - 安装应用程序时,请在选项字典中包含 kCFBundleIdentifierKey

objective-c - XCode Debugger( Debug模式项目)在某一行没有断点停止,Profiler 在同一行崩溃

iphone - 带有滚动按钮​​问题的 UIScrollView

ios - 如何使用 swift 实现点击以专注于条形码扫描器应用程序?

ios - 如果设备版本为 iOS 8,则删除启动屏幕

swift - iOS8中如何实现UISearchController?

ios - 在核心数据中存储上下文属性的最佳方式?

ios - Xcode 8 Swift 3 应用程序能否在 iOS 7 上成功运行?

iphone - TestFlight:应用程序可执行文件包含不受支持的架构:armv7s

ios - 长按多次调用 UIButton 的操作