Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jul 13th, 2013  |  syntax: Objective C  |  size: 1.67 KB  |  views: 39  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. --this is in appdelegate
  2.  
  3. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  4. {
  5.  
  6. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  7.  
  8.     // Override point for customization after application launch.
  9.     UIViewController *viewController1 = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
  10.     UIViewController *viewController2 = [[InformViewController alloc] initWithNibName:@"InformViewController" bundle:nil];
  11.     UIViewController *viewController3 = [[HelpViewController alloc] initWithNibName:@"HelpViewController" bundle:nil];
  12.        
  13.     self.tabBarController = [[UITabBarController alloc] init];
  14.     self.tabBarController.viewControllers = @[viewController1, viewController2, viewController3];
  15.     self.window.rootViewController = self.tabBarController;
  16.    
  17.    
  18.     [self.window makeKeyAndVisible];
  19.     return YES;
  20.  
  21.  
  22.  
  23. --this opens the new view called beta
  24.  
  25. @implementation HomeViewController
  26.  
  27. -(IBAction)Showbeta
  28. {
  29.     betaViewController *betaViewController = [[betaViewController alloc] initWithNibName:nil bundle:nil];
  30.     [self presentViewController:betaViewController animated:YES completion:NULL];    
  31. }
  32.  
  33. --this is in betaviewcontroller
  34.  
  35.  
  36. @interface betaViewController ()
  37.  
  38. @end
  39.  
  40. @implementation betaViewController
  41.  
  42. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  43. {
  44.     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  45.     if (self) {
  46.         // Custom initialization
  47.         // self.window.rootViewController = self.tabBarController; --> this did not work
  48.     }
  49.     return self;
  50. }
clone this paste RAW Paste Data