iOS 6 bug: supportedInterfaceOrientations not called when nav controller used as window root

前端 未结 3 838
隐瞒了意图╮
隐瞒了意图╮ 2020-12-20 01:50

In my mainwindow.xib I have a navigationcontroller. On top of (as a sub item) I have another viewcontroller(homeviewcontroller).

In the nib I have set the window\

相关标签:
3条回答
  • 2020-12-20 02:23

    You need to subclass UINavigationController and override supportedInterfaceOrientations there.

    0 讨论(0)
  • 2020-12-20 02:33

    Do it programmatically at runtime? (In your -applicationDidFinishLaunching: delegate method)

    0 讨论(0)
  • 2020-12-20 02:41

    To elaborate on @phix23's answer, I wrote this tiny UINavigationController subclass

    @implementation MyNavigationController
    
    - (NSUInteger) supportedInterfaceOrientations
    {
        return [[self topViewController] supportedInterfaceOrientations];
    }
    
    @end
    

    From my understanding of the docs mentioned in his comment, this should be the default behavior. But somehow this works for me, while without it, it doesn't

    0 讨论(0)
提交回复
热议问题