zoukankan      html  css  js  c++  java
  • 关于iOS7.0以后修改navigationBar的返回按钮的文本、颜色、自定义按钮等等

    1、返回按钮的颜色

    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

    2、设置返回按钮的内容

    A -> B

    在push的时候,在A中添加代码:

    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] init];
    backItem.title = @"你的文字";
    self.navigationItem.backBarButtonItem = backItem;

    3、自定义navigationBar按钮

    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"全部已读" style:UIBarButtonItemStylePlain target:self action:@selector(allReadedTapped)];

     self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"backIcon"] style:UIBarButtonItemStyleBordered target:self action:@selector(backButtonTouched:)];

    4、自定义navigationBar的title内容和字体大小、颜色

    self.title = @"登 录";

    self.navigationController.navigationBar.titleTextAttributes = @{

                                                                        NSFontAttributeName:[UIFont systemFontOfSize:17],

                                                                        NSForegroundColorAttributeName:[UIColor whiteColor]

                                                                        };

    5、设置navigationBar的背景颜色

    self.navigationController.navigationBar.barTintColor = [UIColor colorFromHexRGB:@"3bad6f" alpha:1.0f];

    6、取消系统中navigationBar的自带的半透效果

    self.navigationController.navigationBar.translucent = NO;

     
  • 相关阅读:
    Mac 上 Go 语言的安装以及编辑器的配置
    【Go学习】立Flag
    python 使用多线程同时执行多个函数
    python闭包
    mfs环境搭建之元数据服务器(master)节点安装-2
    mfs分布式文件系统介绍-01
    vscode中vim插件对ctrl键的设置
    文本截取{}的内容,生成新数组
    如何过滤a数组中b数组存在的值
    js动态加载js文件
  • 原文地址:https://www.cnblogs.com/ChouDanDan/p/5379390.html
Copyright © 2011-2022 走看看