Create a Root View Controller and inherit from the UITabBarController class. Create other view controllers as sub-views of TabBar and store them in arrays.
Override-(void) viewDidLoad method:
-(Void) viewDidLoad {[super viewDidLoad]; // create a view object as the subview LinFirstViewController * pFirstVC = [[LinFirstViewController alloc] initWithNibName: nil bundle: nil] of the TabBar; linSecondViewController * implements condvc = [[LinSecondViewController alloc] initWithNibName: nil bundle: nil]; // stores view objects in arrays to viewControllers self. viewControllers = [NSArray arrayWithObjects: pFirstVC, export condvc, nil]; // release the created object [pFirstVC release]; [Export condvc release];}
In the sub-view. m file, add the code in the-(id) initWithNibName :( NSString *) nibNameOrNil bundle :( NSBundle *) nibBundleOrNil method to set relevant attributes for the TabBar.
// Set the built-in system flag for tabBar, select it in UITabBarSystemItem, and set the label self. tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem: UITabBarSystemItemFavorites tag: 111]; // set the custom name and image for the tabBar. The image can be empty. tabBarItem = [[UITabBarItem alloc] initWithTitle: @ "Second" image: nil tag: 112]; // you can specify the number of display information self. tabBarItem. badgeValue = @ "1 ";