Skip to content

Instantly share code, notes, and snippets.

@borrrden
Created October 1, 2012 08:08
Show Gist options
  • Save borrrden/3810236 to your computer and use it in GitHub Desktop.
Save borrrden/3810236 to your computer and use it in GitHub Desktop.
example of auto rotate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[SO2ViewController alloc] initWithNibName:@"SO2ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
@interface SO2TabViewController : UITabBarController
@end
@implementation SO2TabViewController
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
@end
@implementation SO2ViewController
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (IBAction)showTabBar:(UIButton *)sender
{
SO2ViewController *v1 = [[SO2ViewController alloc] init];
SO2ViewController *v2 = [[SO2ViewController alloc] init];
SO2TabViewController *tab = [[SO2TabViewController alloc] init];
tab.viewControllers = @[v1, v2];
[self presentViewController:tab animated:YES completion:nil];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment