您的位置:首页 > 其它

tabbar小细节

2016-04-17 15:10 351 查看
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];

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: