How to subclass a navigation controller when using storyboards?

I use storyboards in the interface builder using the Xcode menu "Editor ... Embed in ... Navigation Controller".

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

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

But how can I subclass the UINavigationController using the storyboard application since there is no link in the code?

+8
iphone storyboard subclassing uiinterfaceorientation uinavigationcontroller
Oct 18 '12 at 9:10
source share
1 answer

You can select the navigation controller for navigation of the 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 example, change the "Class" 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 
+21
Oct 21 '12 at 15:04
source share



All Articles