需要做成的效果如下图的
// 头标题
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