8

I'm using storyboards in interface builder using the Xcode menu 'Editor...Embed in...Navigation Controller'.

It seems that in iOS 6 you have to subclass the UINavigationController to allow all orientations, with

- (NSUInteger)supportedInterfaceOrientations {
    return (UIInterfaceOrientationMaskAll   );
}

But how do I subclass the UINavigationController with a storyboard app as there is no reference to it in the code?

David Rönnqvist
  • 56,267
  • 18
  • 167
  • 205
SPA
  • 1,279
  • 8
  • 13
  • In Interface Builder, select the UINavigationController then in Identity Inspector tab 3 on right side, change class to your CustomNavigationController name. – Atif Oct 21 '12 at 15:02
  • UINavigationController supports all orientations in iOS6. – deleted_user Oct 28 '12 at 06:48

1 Answers1

21

You can select the navigation controller scene's navigation controller from the storyboard:

enter image description here

And then use the identity inspector on the right to change the class:

enter image description here

For instance change the "Class" there to MyCustomNavigationController and then just create a new class in your project called MyCustomNavigationController:

MyCustomNavigationController.h:

#import <UIKit/UIKit.h>

@interface MyCustomNavigationController : UINavigationController
@end

MyCustomNavigationController.m:

@implementation MyCustomNavigationController

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskAll;
}

... any other methods you want ...

@end
mattjgalloway
  • 34,792
  • 12
  • 100
  • 110