0
votes

How can i rotate tabbarcontroller in landscape mode when i am having XIB file(tab bar controller) in portait.i wrote the follwing in appdelegate

  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } , but it wont be rotated any help please?
1

1 Answers

0
votes

AS i remember, you cannot rotate the SDK's UITabBar controller. You chold make your own tabbar, inherint it from UITabBar and there return YES in shouldAutoRotate method.

#import <UIKit/UIKit.h>    
  @interface MainTabBarController : UITabBarController{
  }    
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
@end  

this is an .h file

#import "MainTabBarController.h"
@implementation MainTabBarController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return YES;
} 
@end

You just have to change class of your tabbar from UITabBarController to MainTabBarController