Created
October 1, 2012 08:08
-
-
Save borrrden/3810236 to your computer and use it in GitHub Desktop.
example of auto rotate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (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