What you want can be done... (below is example for only landscape orientation for app)
Create custom navigation controller
CustomNavigationController.h
#import <UIKit/UIKit.h>
@interface CustomNavigationController : UINavigationController
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation;
-(BOOL)shouldAutorotate;
- (NSUInteger)supportedInterfaceOrientations;
@end
CustomNavigationController.m
- (BOOL)shouldAutorotate
{
return [self.visibleViewController shouldAutorotate];
}
- (NSUInteger)supportedInterfaceOrientations
{
if (![[self.viewControllers lastObject] isKindOfClass:NSClassFromString(@"ViewController")])
{
return UIInterfaceOrientationMaskLandscape;
}
else
{
return [self.topViewController supportedInterfaceOrientations];
}
}
Include below in all files where you want only landscape...
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
NSLog(@"1. shouldAutorotateToInterfaceOrientation");
if (interfaceOrientation==UIInterfaceOrientationMaskPortrait) {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
||(interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationLandscapeLeft;
}
- (BOOL)shouldAutorotate
{
return YES;
}