我是靠谱客的博主 怕孤单黄蜂,这篇文章主要介绍iOS -- 导航栏和标签栏的一些设置,现在分享给大家,希望可以做个参考。


UINavigationBar && UITabbarItem相关

设置导航栏字体的大小以及颜色

[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:16]}];

设置标签栏字体的大小和选中颜色

- (void)setupTabbarItemProperty:(UITabBarItem *)tabbarItem{
//改变字体颜色
[tabbarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor lightGrayColor],NSFontAttributeName:[UIFont systemFontOfSize:12]} forState:UIControlStateNormal];
//选中状态颜色
[tabbarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor greenColor],NSFontAttributeName:[UIFont systemFontOfSize:12]} forState:UIControlStateSelected];
}

设置导航栏返回按钮保留箭头 去除文字

标准答案:

//方法 一 :
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
forBarMetrics:UIBarMetricsDefault];
//方法 二 :
UIBarButtonItem *barBtnItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"iOS7BackButton"] style:UIBarButtonItemStylePlain target:self action:@selector(goToPrevious:)];
self.navigationItem.leftBarButtonItem = barBtnItem;

等多个方案……

设置界面跳转时隐藏tabbar

- (void)pushToViewController:(UIViewController *)itemVC{
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:itemVC animated:NO];
self.hidesBottomBarWhenPushed = NO;
}

最后

以上就是怕孤单黄蜂最近收集整理的关于iOS -- 导航栏和标签栏的一些设置的全部内容,更多相关iOS内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(54)

评论列表共有 0 条评论

立即
投稿
返回
顶部