The hierarchy of the UI component is shown in the diagram below:
Nesting Navigation Controllers in UITabBarController
Nesting Navigation Controllers in UITabBarController
- Create UITabBarController
tabBarController = [[UITabBarController alloc] init];
- Create each UINavigationController
UINavigationController *navController1 = [[UINavigationController alloc] init];
[navController pushViewController: firstViewController animated: NO];
// ..... create other UINavigationController
[navController pushViewController: firstViewController animated: NO];
// ..... create other UINavigationController
- Add all the UINavigationController / UIViewController to UITabBarController
tabBarController.viewControllers = [NSArray arrayWithObjects:
navController1,
navController2,
otherViewController,
nil ];
[window addSubView:tabBarController.view];
The above code is typically add to applicationDelegate viewDidFinishLaunchingWithOptions method.navController1,
navController2,
otherViewController,
nil ];
[window addSubView:tabBarController.view];
Customizing the UI controller
The Title on the UINavigationController can be customized by changing the viewController.title field in the viewDidLoad method in the view class. Eg:
firstView.title = @"First View";
- The TabBarItem image and title can be customized by changing the tabBarItem field in navigationController or viewController. Eg: The customization code can be added to the viewDidLoad method of the viewController.
- UITabBarItem *item = [[UITabBarItem alloc] initWithTitle:@"Playlists" image: [UIImage imageNamed:@"music.png"]
tag: 0];
self.tabBarItem = item;
[item release];
- System item can also be added to the tab bar, Eg:
UITabBarItem *item = [[UITabBarItem alloc] initWithTabBarSystemItemItem:
UITabBarSystemItemContacts tag:0];
navigationController.tabBarItem = item;
[item release];
UITabBarSystemItemContacts tag:0];
navigationController.tabBarItem = item;
[item release];
Nice and very helpful information i have got from your post. Even your whole blog is full of interesting information which is the great sign of a great blogger.
ReplyDeleteLenovo - IdeaPad 15.6" Laptop - 6GB Memory - 1TB Hard Drive - Dark Chocolate
Lenovo - 14" Notebook - 4 GB Memory - 320 GB Hard Drive - Black