#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@end
#import "AppDelegate.h"
#import "KeyViewController.h"
@interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
//初始化导航
UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:[[KeyViewController alloc] init]]; //设置导航栏的背景颜色(iOS7之后)
[[UINavigationBar appearance] setBarTintColor:[[UIColor alloc] initWithRed:/255.0 green: blue:/255.0 alpha:]]; //使用背景图片来设置导航栏的颜色(iOS7之后)
// [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"顶栏背景"] forBarMetrics:UIBarMetricsDefault]; //设置导航栏上文字的颜色(iOS7之后)
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]}];
self.window.rootViewController = navi; [self.window makeKeyAndVisible];
return YES;
} @end
#import <UIKit/UIKit.h>

@interface KeyViewController : UIViewController

@end
#import "KeyViewController.h"
#import "CashViewController.h"
@interface KeyViewController () @end @implementation KeyViewController - (void)viewDidLoad {
[super viewDidLoad];
self.title = @"提取现金";
UIButton *getCashBtn = [UIButton buttonWithType:UIButtonTypeCustom];
getCashBtn.frame = CGRectMake(, , , );
[getCashBtn setTitle:@"下一页面" forState:];
getCashBtn.backgroundColor = [UIColor orangeColor];
[getCashBtn addTarget:self action:@selector(getCashAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:getCashBtn];
} - (void)getCashAction:(UIButton *)sender{
CashViewController *cashVC = [[CashViewController alloc] init];
[self.navigationController pushViewController:cashVC animated:YES];
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end
#import <UIKit/UIKit.h>

@interface CashViewController : UIViewController

@end
#import "CashViewController.h"

@interface CashViewController ()

@end

@implementation CashViewController

- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"银行卡绑定";
self.view.backgroundColor = [UIColor whiteColor]; //使用图片来设置导航栏左边的按钮
// UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"返回按钮"] style:UIBarButtonItemStylePlain target:self action:@selector(goBackAction:)]; //设置导航栏左边按钮的文字
UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithTitle:@"< 返回" style:UIBarButtonItemStylePlain target:self action:@selector(goBackAction:)]; //设置导航栏左边按钮文字的颜色(以及背景图片的颜色)
leftItem.tintColor = [UIColor whiteColor];
self.navigationItem.leftBarButtonItem = leftItem;
}
/**
* 点击导航栏左边按钮所触发的事件
*/
- (void)goBackAction:(UIButton*)sender{
[self.navigationController popViewControllerAnimated:YES];
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; } @end

iOS 设置导航栏之二(设置导航栏的颜色、文字的颜色、左边按钮的文字及颜色)的更多相关文章

  1. iOS学习——更改导航栏的返回按钮的标题与颜色

    转载自:修改navigationController返回按钮颜色和文字 今天在做项目时遇到这个问题,试了很多方法都失败了.最后终于找到正确的方案了,在这里分享给大家. 引言 在iOS开发过程中,Nav ...

  2. iOS筛选菜单、分段选择器、导航栏、悬浮窗、转场动画、启动视频等源码

    iOS精选源码 APP启动视频 自定义按钮,图片可调整图文间距SPButton 一款定制性极高的轮播图,可自定义轮播图Item的样式(或只... iOS 筛选菜单 分段选择器 仿微信导航栏的实现,让你 ...

  3. iOS侧滑返回到隐藏导航栏的VC,导航栏会闪现一次

    VCA:是一个隐藏导航栏的页面:VCA在ViewWillAppear生命周期函数中设置导航栏隐藏: //隐藏导航栏 [self.navigationController setNavigationBa ...

  4. iOS 11开发教程(二十)iOS11应用视图美化按钮之设置按钮的状态

    iOS 11开发教程(二十)iOS11应用视图美化按钮之设置按钮的状态 在示例2-2中,设置按钮的标题和颜色时,需要对按钮的状态进行设置,表示按钮在某一状态下的标题和标题颜色是什么样子.例如,UICo ...

  5. 跟我学SharePoint2013视频培训课程——设置列表名称、描述、导航等基本信息(12)

    课程简介 第12天,怎样在SharePoint 2013设置列表名称.描述.导航等基本信息. 视频 SharePoint 2013 交流群 41032413

  6. iOS之旅--隐藏(去除)导航栏底部横线

    iOS之旅--隐藏(去除)导航栏底部横线 iOS开发大部分情况下会使用到导航栏,由于我司的app导航栏需要与下面紧挨着的窗口颜色一致,导航栏底部的横线就会影响这个美观,LZ使用了以下方法.觉得不错,分 ...

  7. iOS开发UI篇—多控制器和导航控制器简单介绍

    iOS开发UI篇—多控制器和导航控制器简单介绍 一.多控制器 一个iOS的app很少只由一个控制器组成,除非这个app极其简单.当app中有多个控制器的时候,我们就需要对这些控制器进行管理 有多个vi ...

  8. iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期

    iOS开发UI篇—使用storyboard创建导航控制器以及控制器的生命周期 一.基本过程 新建一个项目,系统默认的主控制器继承自UIViewController,把主控制器两个文件删掉. 在stor ...

  9. 微信小程序------导航栏样式、tabBar导航栏

    一:导航栏样式设置 小程序的导航栏样式在app.json中定义. 这里设置导航,背景黑色,文字白色,文字内容测试小程序 app.json内容: { "pages":[ " ...

随机推荐

  1. JavaScript系列:再巩固-原型链

    图 1.实例:'对象(实例)'有属性__proto__,指向该对象(实例)的'构造函数的原型对象'. 2.方法:'构造函数'除了有属性__proto__,所有构造函数方法的__proto__指向Fun ...

  2. garbage collection - 垃圾收集

    Professional.JavaScript.for.Web.Developers.3rd.Edition.Jan.2012 JavaScript is a garbage-collected la ...

  3. Git相关的项目

    1.posh-git Git的PowerShell扩展 项目地址: https://github.com/dahlbyk/posh-git 可以用psget快速安装扩展模块,psget下载安装地址 h ...

  4. JAVA Exchanger

    //Exchanger工具类的使用案例 //本文给出一个简单的例子,实现两个线程之间交换数据,用Exchanger来做非常简单. import java.util.concurrent.Exchang ...

  5. https centos6 and 7

    keytool -printcert -sslserver 10.10.192.90:8443 -rfc >nexus.crt 通过  openssl 将 证书转换为 .pem格式的 通过以下命 ...

  6. CDH介绍

    本文引用自:Cloudera 系列2:CDH介绍http://www.aboutyun.com/thread-18379-1-1.html(出处: about云开发) CDH提供: 灵活性-存储任何类 ...

  7. X-UA-Compatible是神马

    X-UA-Compatible是神马 X-UA-Compatible是IE8的一个专有<meta>属性,它告诉IE8采用何种IE版本去渲染网页,在html的<head>标签中使 ...

  8. jade反编译

    安装html2jade npm install html2jade -g 反编译,默认输出同名jade html2jade test2.html 反编译为其他文件名 html2jade test2.h ...

  9. 验证整数、小数、实数、有效位小数最简单JavaScript正则表达式

    输入完按回车后即可验证!(自认为最简单!) 正整数:  负整数:  整 数:  正小数:  负小数:  小 数:  实 数:  保留1位小数: 保留2位小数: 保留3位小数: 说明:IE6.0.IE7 ...

  10. [LeetCode]题解(python):050-Pow(x, n)

    题目来源 https://leetcode.com/problems/powx-n/ Implement pow(x, n). 题意分析 Input: x,n Output:pow(x,n) Cond ...