码迷,mamicode.com
首页 > 其他好文 > 详细

navigationController .navigationBar 的属性设置

时间:2016-05-24 00:18:01      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:

需要做成的效果如下图的

技术分享

// 头标题
    self.title = @"求租仓库";
    // 注册cell [用xib时候的注册方法]
    [self.tableView registerNib:[UINib nibWithNibName:@"MyTableViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];
    // 设置背景颜色用rgb值设置的,// [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] rgb就是对应你想设置成的颜色的具体数值,可用数码测色计检测
    self.navigationController.navigationBar.barTintColor =
    [UIColor  colorWithRed:48/255.0 green:100/255.0 blue:210/255.0 alpha:1];
    // 设置半透明度
     self.navigationController.navigationBar.translucent = YES;
    // 注释的方法系统已经弃用但是也可以使用
//       UIColor * color = [UIColor whiteColor];
//      NSDictionary * dict=[NSDictionary dictionaryWithObject:color forKey:UITextAttributeTextColor];
//    self.navigationController.navigationBar.titleTextAttributes = dict;
    
    // 设置self.title的背景颜色和大小
    self.navigationController.navigationBar.titleTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:20], NSForegroundColorAttributeName:[UIColor whiteColor]};
    // 设置样式
    self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
    // 添加右按钮
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"筛选" style:UIBarButtonItemStylePlain target:self action:@selector(rightBarButtonItemClick:)];
    // 左按钮
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(again)];
    [self loadHandel];
    [self loadHandelType];
    // 这种方法是在Appdelegate中写appearance表示出现的时候
//     [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
    // 这种方法可以直接在didLoad中实现
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];

 

navigationController .navigationBar 的属性设置

标签:

原文地址:http://www.cnblogs.com/menglingxu/p/5521803.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!