1.从storyboard得到tabBarItem并对其设置选中等各个状态
建立一个tabbarController并和故事版关联
之后利用得到对用item 对其进行操作
UITabBarItem *item1 = self.tabBar.items[0];
2.得到tabbar 左边图片 右边文字
更改图片和文字位置
vc.tabBarItem.imageInsets = UIEdgeInsetsMake(5, -30, -5, 30);
//更改字体和位置
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:14],NSFontAttributeName, nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitlePositionAdjustment:UIOffsetMake(15, -15.0)];
3.push另一个界面隐藏 tabbar
在navigation中重写该方法
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
NSLog(@"1111-%ld",self.viewControllers.count );
if (self.viewControllers.count>0 ) {
viewController.hidesBottomBarWhenPushed = YES;
}
[super pushViewController:viewController animated:animated];
}