Reputation: 35
How can I support portrait and landscape orientation for Tab bar application in ios 5 (StoryBoard).
Any Help is appreciated.
Upvotes: 0
Views: 1336
Reputation: 9600
UITabBarController have a some problem. the problems is a subviews(selected index) not autorotate.
So, you can make a category, and add a below code.
and, add a #import "UITabBarController+Autorotate.h"
#import <Foundation/Foundation.h>
@interface UITabBarController (Autorotate)
@end
#import "UITabBarController+Autorotate.h"
@implementation UITabBarController (Autorotate)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
UIViewController *controller = self.selectedViewController;
if ([controller isKindOfClass:[UINavigationController class]])
controller = [(UINavigationController *)controller visibleViewController];
return [controller shouldAutorotateToInterfaceOrientation:interfaceOrientation];
}
@end
Upvotes: 1