创建底部标签控制器
#import "ViewController.h"
#import "oneViewController.h"
#import "twoViewController.h"
#import "threeViewController.h"
#import "fourViewController.h"
#import "fiveViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//首先初始化controller
oneViewController *one = [oneViewController new];
//创建第一个
UINavigationController *oneNav = [[UINavigationController alloc]initWithRootViewController:one];
oneNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"今日特卖" image:[UIImage imageNamed:@"aa"] selectedImage:[UIImage imageNamed:@"aa"]];
//第二个
twoViewController *two = [twoViewController new];
UINavigationController *twoNav = [[UINavigationController alloc]initWithRootViewController:two];
twoNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"社区" image:[UIImage imageNamed:@"bb"] selectedImage:[UIImage imageNamed:@"bb"]];
//第三个
threeViewController *three = [threeViewController new];
UINavigationController *threeNav = [[UINavigationController alloc]initWithRootViewController:three];
threeNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"升级权益" image:[UIImage imageNamed:@"cc"] selectedImage:[UIImage imageNamed:@"cc"]];
//第四个
fourViewController *four = [fourViewController new];
UINavigationController *fourNav = [[UINavigationController alloc]initWithRootViewController:four];
fourNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"购物车" image:[UIImage imageNamed:@"dd"] selectedImage:[UIImage imageNamed:@"dd"]];
//第五个
fiveViewController *five = [fiveViewController new];
UINavigationController *fiveNav = [[UINavigationController alloc]initWithRootViewController:five];
fiveNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"个人中心" image:[UIImage imageNamed:@"ee"] selectedImage:[UIImage imageNamed:@"ee"]];
self.viewControllers=@[oneNav,twoNav,threeNav,fourNav,fiveNav];
}
@end