AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
UITabBarController *tabBarController = [[UITabBarController alloc] init];
FirstViewController *firstViewController = [[FirstViewController alloc] init];
firstViewController.title = @"首页";
UIImage *image = [UIImage imageNamed:@"4-selected@2x.png"];
image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIImage *selectImage = [UIImage imageNamed:@"4-nomal@2x.png"];
selectImage = [selectImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
firstViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:image selectedImage:selectImage];
UINavigationController *firseNavigaton = [[UINavigationController alloc] initWithRootViewController:firstViewController];
SecondViewController *secondViewController = [[SecondViewController alloc] init];
secondViewController.title = @"我的";
tabBarController.viewControllers = @[firseNavigaton,secondViewController];
self.window.rootViewController = tabBarController;
//tabBar属性
tabBarController.tabBar.tintColor = [UIColor blackColor];
//tabBarController.tabBar.barTintColor = [UIColor greenColor];
//不透明
tabBarController.tabBar.translucent = NO;
return YES;
}
UITabBarController 就是像微信下面的(我的、发现、通讯录、首页)这类的东西,基本上的App都有这个,大家要熟练应用哦