Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 20th, 2012  |  syntax: None  |  size: 0.92 KB  |  hits: 16  |  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. Tab bar seems to be locked (default settings)
  2. // Create the main tabbar controller
  3. tabbarController = [[UITabBarController alloc] init];
  4.  
  5. // Create the first view controller
  6. MyFirstViewController *v1 = [[MyFirstViewController alloc] initWithNibName:@"MyfirstViewController" bundle:nil];
  7. [v1 setTitle:@"Tab1"];
  8.  
  9. // Create second view controller
  10. MySecondViewController *v2 = [[MySecondViewController alloc] initWithNibName:@"MySecondViewController" bundle:nil];
  11. [v2 setTitle:@"Tab2"];
  12.  
  13. // Make an array of controllers for the tabbar
  14. NSArray *tabbarControllerArray = [NSArray arrayWithObjects:v1, v2, nil];
  15.  
  16. // Set the view controllers used by the tabbar controller
  17. [tabbarController setViewControllers:tabbarControllerArray];
  18.  
  19. // Release views (retained elsewhere)
  20. [v1 release];
  21. [v2 release];
  22.  
  23. // Add the controller to the subview
  24. [window addSubview:[tabbarController view]];
  25.  
  26. // Make key and visible
  27. [self.window makeKeyAndVisible];