0

So here is my question.

I am using s subview of my MainViewcontroller to implement a TabBar in the following manner:

@class MainViewController;

@interface MyAppDelegate : NSObject <UIApplicationDelegate>
{

  // UITabBarController root controller view
  UITabBarController *rootController;
}

// Added
@property (nonatomic, retain) IBOutlet UITabBarController *rootController;

@end

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary 
*)launchOptions
{    

   // Added root controller
   [self.window addSubview:rootController.view];

   return YES;
}

I have 4 view controllers and 4 tabs. I have specified in each tab view .m and in the main view controller:

// Autoration of view orientations 
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}

I get no rotation to any orientation but in my main view controller. I thought I needed to override the main view but my understanding is not sufficient. Please provide me with assistance.

user633658
  • 2,463
  • 2
  • 18
  • 16

1 Answers1

0

Take a look at this. And at this question here.

Community
  • 1
  • 1
SideSwipe
  • 559
  • 3
  • 15
  • These approach Tab Bar form the point of view of directly using Tab Bar application in the creation of the project or making a Tab Bar some other way. Noe of them subclassed their main view controller and added a tab bar to their mainwindow.xib. I created my Tab bar in a manner much different than they did. I also read these solutions and they did not help me. – user633658 Mar 11 '12 at 00:38
  • Part of the problem is I used an instance of UITabBarController as my root controller instead of creating my own root controller. – user633658 Mar 11 '12 at 00:44
  • They do it in exactly the same manner as you do. If you use InterfaceBuilder to manipulate MainWindow.xib, just change the class of your UITabBar to the name of your subclass and import its .h file. Use the subclass of UITabBarController as your root controller. – SideSwipe Mar 11 '12 at 00:45
  • If I understand what you are saying, I extend UITabBarController (sub class) it and override the should rotate, import it ot my main view controller and change UITabBar to my sub class. – user633658 Mar 11 '12 at 00:59