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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值