tabBarController简单属性

来源:互联网 发布:淘宝假货 猪哼少 编辑:程序博客网 时间:2024/06/04 23:32
 UIViewController *v1=[[UIViewController alloc] init];    v1.view.backgroundColor=[UIColor redColor];    UITabBarItem *v1BI=[[UITabBarItem alloc] initWithTabBarSystemItem: UITabBarSystemItemFavorites tag:101];    v1.tabBarItem=v1BI;    v1.tabBarItem.badgeValue=@"new";    v1.title=@"v1";    UINavigationController *v1NC=[[UINavigationController alloc] initWithRootViewController:v1];                UIViewController *v2=[[UIViewController alloc] init];    v2.view.backgroundColor=[UIColor greenColor];    UITabBarItem *v2BI=[[UITabBarItem alloc] initWithTitle:@"V2+" image:[UIImage imageNamed:@"201.png"] tag:102];    v2.tabBarItem=v2BI;



 NSArray *conreollerArray=@[v1NC,v2];                //创建tabBarController    UITabBarController *rootBC=[[UITabBarController alloc] init];    rootBC.viewControllers=conreollerArray;    rootBC.tabBar.tintColor=[UIColor redColor];    rootBC.selectedIndex=1;    rootBC.delegate=self;    self.window.rootViewController=rootBC;


0 0