tabBarController

  self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]bounds]];

    self.window.backgroundColor = [UIColor whiteColor];

  

    

    UITabBarController *tb = [[UITabBarController alloc] init];

    tb.tabBar.translucent = NO;

    self.window.rootViewController=tb;

    

    

    oneViewController *c1 = [[oneViewController alloc] init];

    c1.view.backgroundColor=[UIColor greenColor];

    c1.tabBarItem.title=@"消息";

    c1.tabBarItem.image=[UIImage imageNamed:@"1.png"];

    c1.tabBarItem.badgeValue=@"123";

    

    

    

    twoViewController *c2=[[twoViewController alloc]init];

    c2.view.backgroundColor=[UIColor brownColor];

    c2.tabBarItem.title=@"联系人";

    c2.tabBarItem.image=[UIImage imageNamed:@"2.png"];

    

    UIViewController *c3=[[UIViewController alloc]init];

    c3.view.backgroundColor = [UIColor yellowColor];

    c3.tabBarItem.title=@"动态";

    c3.tabBarItem.image=[UIImage imageNamed:@"3.png"];

    

    UIViewController *c4=[[UIViewController alloc]init];

    c4.tabBarItem.title=@"设置";

    c4.view.backgroundColor = [UIColor blueColor];

    c4.tabBarItem.image=[UIImage imageNamed:@"4.png"];

    

    

    tb.viewControllers =@[c1,c2,c3,c4];

    [self.window makeKeyAndVisible];


你可能感兴趣的:(tabBarController)