You need to subclass the UINavigationController like this.
.H
#import <UIKit/UIKit.h>
@interface UINavigationController (Rotation)
- (BOOL)shouldAutorotate;
- (NSUInteger)supportedInterfaceOrientations;
@end
.M
#import "UINavigationController+Rotation.h"
@implementation UINavigationController (Rotation)
- (BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations {
if ([self visibleViewController] && [[self visibleViewController] isKindOfClass:[B class]]) {
return UIInterfaceOrientationMaskAll;
}
return UIInterfaceOrientationMaskPortrait;
}
@end