Monday, June 10, 2013

UITabBarItem UITabBarSystemItemMostRecent example in Objective C (iOS).

UITabBarItem UITabBarSystemItemMostRecent


UITabBarSystemItem
System items that can be used on a tab bar.

typedef enum {
UITabBarSystemItemMore,
UITabBarSystemItemFavorites,
UITabBarSystemItemFeatured,
UITabBarSystemItemTopRated,
UITabBarSystemItemRecents,
UITabBarSystemItemContacts,
UITabBarSystemItemHistory,
UITabBarSystemItemBookmarks,
UITabBarSystemItemSearch,
UITabBarSystemItemDownloads,
UITabBarSystemItemMostRecent,
UITabBarSystemItemMostViewed,
} UITabBarSystemItem;

Constants
UITabBarSystemItemMore
The more system item.
UITabBarSystemItemFavorites
The favorites system item.
UITabBarSystemItemFeatured
The featured system item.
UITabBarSystemItemTopRated
The top rated system item.
UITabBarSystemItemRecents
The recents system item.
UITabBarSystemItemContacts
The contacts system item.
UITabBarSystemItemHistory
The history system item.
UITabBarSystemItemBookmarks
The bookmarks system item.
UITabBarSystemItemSearch
The search system item.
UITabBarSystemItemDownloads
The downloads system item.
UITabBarSystemItemMostRecent
The most recent system item.
UITabBarSystemItemMostViewed
The most viewed system item.

Discussion of [UITabBarItem UITabBarSystemItemMostRecent]
The title and image of system tab bar items cannot be changed.

UITabBarItem UITabBarSystemItemMostRecent example.
UITabBarItem *favorites = [[UITabBarItem alloc] initWithTitle:nil image:a1 tag:0];
UITabBarItem *bookmarks = [[UITabBarItem alloc] initWithTabBarSystemItem: UITabBarSystemItemBookmarks tag:1];
UITabBarItem *featured = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:2];
UITabBarItem *mostRecent = [[UITabBarItem alloc] initWithTabBarSystemItem: UITabBarSystemItemMostRecent tag:3];

Example of [UITabBarItem UITabBarSystemItemMostRecent].
//Create TabBar View here
-(void)createTabBarView
{
     NSMutableArray *tabItems = [NSMutableArray array];
     UIViewController *firstViewController = [[FirstViewController alloc] init];;
     firstViewController = @"First View";
     firstViewController = [[UITabBarItem alloc]initWithTabBarSystemItem: UITabBarSystemItemMostRecent tag:0];
      [tabItems addObject:firstViewController];
      UIViewController *secondViewController = [[SecondViewController alloc] init];;
      secondViewController = @"Second View";
      secondViewController = [[UITabBarItem alloc]initWithTabBarSystemItem: UITabBarSystemItemMostRecent tag:1];
      [tabItems addObject:secondViewController];
      self.tabBarController = [[UITabBarController alloc]init];
      self.tabBarController.viewControllers = tabItems;   
      self.tabBarController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
      [self presentModalViewController:tabBarController animated:YES];
}

UITabBarItem UITabBarSystemItemMostRecent example.
    ThirdViewController *thirdViewController = [[ThirdViewController alloc]init];
    thirdViewController.title = @"Third View";
    thirdViewController.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem: UITabBarSystemItemMostRecent tag:2];
    UINavigationController *thirdNavController = [[UINavigationController alloc]initWithRootViewController:thirdViewController];

End of UITabBarItem UITabBarSystemItemMostRecent example article.