**********************************************************
//首先将导航控制器或视图控制器放到数组中controllerArr
//创建一个分栏控制器的实例对象
UITabBarController *tbc = [[UITabBarController alloc]init];
//将页面数组设置给分栏控制器
tbc.viewControllers = controllerArr;
//内容渲染色,和navigationbar的设置类似
tbc.tabBar.tintColor = [UIColor redColor];
//背景色
tbc.tabBar.barTintColor = [UIColor grayColor];
//背景图片
self.tabBar.backgroundImage = [UIImage imageNamed:@"tabbg"];
//将分栏控制器设为window的根控制器
self.window.rootViewController = tbc;
FiveViewController *fvc = [[FiveViewController alloc]init];
//弹出新页面时隐藏tabBar
fvc.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:fvc animated:YES];
**********************************************************
UITabBarItem分栏控制器专用按钮
//使用系统样式,自带图片和title
- (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag;
//使用1张图片和文字
- (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag;
//使用2张图片和文字
- (instancetype)initWithTitle:(NSString *)title image:(UIImage *)image selectedImage:(UIImage *)selectedImage;
//item中的图片都是取形状然后进行渲染,如果不想渲染,而是想用图片本身的颜色,让图片调个方法
//返回值也是图片,并且这个图片不会被渲染,而是使用图片本身的颜色
//[[UIImage imageNamed:@"tab_0"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
**********************************************************
自定义tabBar思路:
一、设置tbc(tabBarController)的viewControllers,
二、把一个包含button和label的视图放到tabBar上,
三、button的点击事件里处理变色以及设置tbc的selectedIndex