
Untitled
By: a guest on
May 20th, 2012 | syntax:
None | size: 0.92 KB | hits: 16 | expires: Never
Tab bar seems to be locked (default settings)
// Create the main tabbar controller
tabbarController = [[UITabBarController alloc] init];
// Create the first view controller
MyFirstViewController *v1 = [[MyFirstViewController alloc] initWithNibName:@"MyfirstViewController" bundle:nil];
[v1 setTitle:@"Tab1"];
// Create second view controller
MySecondViewController *v2 = [[MySecondViewController alloc] initWithNibName:@"MySecondViewController" bundle:nil];
[v2 setTitle:@"Tab2"];
// Make an array of controllers for the tabbar
NSArray *tabbarControllerArray = [NSArray arrayWithObjects:v1, v2, nil];
// Set the view controllers used by the tabbar controller
[tabbarController setViewControllers:tabbarControllerArray];
// Release views (retained elsewhere)
[v1 release];
[v2 release];
// Add the controller to the subview
[window addSubview:[tabbarController view]];
// Make key and visible
[self.window makeKeyAndVisible];