#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. 40. 特殊a串数列求和

    特殊a串数列求和 #include <stdio.h> int main() { int i, a, n, item, sum, temp; while (scanf("%d % ...

  2. Bootstrap页面布局3 - BS布局以及流动布局

    1. <h1 class='page-header'>布局<small> 使用bootstrap网格系统布局网页</small></h1> 得到如图所示 ...

  3. nginx 配置多个二级域名

    server { server_name domain.com www.domain.com *.domain.com ; set $subdomain ''; if ($host ~* (\b(?! ...

  4. Android 加入一个动作按钮

    在XML中声明一个动作按钮 所有的动作按钮和其他的可以利用的items都定义在menu资源文件夹中的XML文件中.为了增加一个动作按钮到工具栏,需要在工程 /res/menu/ 目录下面创建一个新的X ...

  5. SqlServer中的一些非常用功能

    1.启用双引号作为分隔符 Set Quoted_Identifier on 此时:create table dbo.testcolumn("column" char(2))是合法的 ...

  6. Windows下git使用代理服务器的设置方法

    在我朝独有的无敌GFW关照下(当然,也有可能IP被网站封了),要下载网络上开源的软件是非常困难的一件事情,在这种情况下,使用VPN或者代理服务器就非常有必要了.对于单个应用FQ来说,个人比较喜欢用FQ ...

  7. Android HttpHeader的坑

    昨天遇到一个问题,代码如下: private String getSessionId(HttpResponse response) { // TODO Auto-generated method st ...

  8. dom classList

    才发现dom对象就有classList属性,通过它可以判断该dom是否有指定的class名存在. var tar = e.target; var classList = tar.classList; ...

  9. Prestashop 页面空白

    Advanced Parameters > Performance页面空白,无任何提示错误,解决方法: 更改文件/cache/class_index.php 权限为666

  10. 获取设备的唯一标识uuid

    摘自:http://blog.sina.com.cn/s/blog_5971cdd00102vqgy.html -(NSString*) uuid { CFUUIDRef puuid = CFUUID ...