美文网首页
iOS设置导航条颜色及按钮颜色大小

iOS设置导航条颜色及按钮颜色大小

作者: 一个萝卜X个坑 | 来源:发表于2018-07-03 16:18 被阅读107次
//设置导航条颜色
    self.navigationController.navigationBar.barTintColor =[UIColor 颜色]];;
    self.navigationController.navigationBar.barStyle = UIStatusBarStyleDefault;
//设置当前导航条返回按钮颜色
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
//设置导航条标题大小及颜色
self.navigationItem.title = @"余额";
    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor],
                                                                      NSFontAttributeName : [UIFont fontWithName:@"Helvetica-Bold" size:17]}];

//设置导航条透明
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:[UIImage new]];
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
    [self.navigationController.navigationBar setShadowImage:nil];
}

相关文章

网友评论

      本文标题:iOS设置导航条颜色及按钮颜色大小

      本文链接:https://www.haomeiwen.com/subject/btkjuftx.html