//设置导航条的样式

self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;

//默认是白色  Bar 字体颜色黑色,如果样式设置黑色,对应的字体就是白色。

//定义导航条的时候使用

self.navigationController.navigationBar.translucent = YES;

//设置导航条的背景颜色

self.navigationController.navigationBar.backgroundColor = [UIColor redColor];

//也可以是一张图

[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"back.png"] forBarMetrics:UIBarMetricsDefault];

//设置裁剪属性 44 超出的部分减掉

self.navigationController.navigationBar.clipsToBounds = YES;

//左侧item

UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRewind target:self action:@selector(barButtonClick:)];

//设置唯一的标签

leftButton.tag = 101;

//添加到导航条上

self.navigationItem.leftBarButtonItem = leftButton;

//添加一个右侧的按钮

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFastForward target:self action:@selector(barButtonClick:)];

rightButton.tag = 102;

self.navigationItem.rightBarButtonItem = rightButton;

//设置navigationItem的标题

self.navigationItem.title = @"我的歌声里";

//设置副标题

self.navigationItem.prompt = @"曲婉婷";

//再创建一个UIBarButtonItem类型的按钮

UIBarButtonItem *leftButton1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPause target:self action:@selector(barButtonClick:)];

//设置左视图(多个按钮)

NSArray *leftBarButtonArray = @[leftButton,leftButton1];

//把这个数组设置给自动扩展位置   navigationItem.leftBarButtonItems 属性

self.navigationItem.leftBarButtonItems = leftBarButtonArray;

//自定义UINavigationItem的titleView

UIView *newTilteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 44)];

newTilteView.backgroundColor = [UIColor redColor];

//添加到父视图上

self.navigationItem.titleView = newTilteView;

//如果MRC 考虑内存管理

#pragma mark - 显示ToolBar工具条

-(void)viewWillAppear:(BOOL)animated

{

[super viewWillAppear:animated];

//默认 YES 隐藏的,NO 显示出来的

self.navigationController.toolbarHidden = NO;

//设置工具条的样式

self.navigationController.toolbar.barStyle = UIBarStyleBlack;

//因为iOS7系统默认开启了透明选项

self.navigationController.toolbar.translucent = YES;

//给工具条添加按钮  1...多个 UIBarButtonItem

UIBarButtonItem *btn1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(btnClick:)];

btn1.tag = 103;

//创建按钮2

UIBarButtonItem *btn2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(btnClick:)];

btn2.tag = 104;

//给btn1 弹簧 btn2

UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

//添加到工具条上

NSArray *toolArray = @[btn1,space,btn2];

//显示按钮

self.toolbarItems = toolArray;

}

 

//页面跳转(下一界面)

[self.navigationController pushViewController:svc animated:YES];

//返回上一界面

[self.navigationController popViewControllerAnimated:YES];

iOS笔记之UIKit_UINavigationController的更多相关文章

  1. 荼菜的iOS笔记--UIView的几个Block动画

    前言:我的第一篇文章荼菜的iOS笔记–Core Animation 核心动画算是比较详细讲了核心动画的用法,但是如你上篇看到的,有时我们只是想实现一些很小的动画,这时再用coreAnimation就会 ...

  2. IOS笔记 1

    < ![CDATA[ 笔记 UIWindows 与UIView的关系iOS的坐标系统视图层次结构视图坐标(Frame和Bounds区别)UIView的常用属性和方法坐标系统的变换UIView内容 ...

  3. 【转】iOS笔记-自定义控件(OC)

    原文网址:http://www.jianshu.com/p/f23862eb7b8a 导读: iOS开发中,很多时候系统提供的控件并不能很好的满足我们的需求,因此,自定义控件便成为搭建UI界面中必不可 ...

  4. iOS笔记———数据存储

    应用沙盒:应用文件系统的根目录,每个应用都有独自的沙盒相互:在xcode中可以用NSHomeDirectory()函数,打印当前应用的沙盒根路径. 应用程序包:包含了所有资源文件和执行文件; * Do ...

  5. Xamarin开发IOS笔记:切换输入法时输入框被遮住

    在进行IOS开发的过程中,出现类似微信朋友圈的交互界面,当用户遇到感兴趣的内容可以进行评论.为了方便评论输入,当出现评论输入框的时候自动将评论输入框移动至键盘的上方,这样方便边输入边查看. 当用户隐藏 ...

  6. 【IOS笔记】Delegation

    Delegation Delegation is a simple and powerful pattern in which one object in a program acts on beha ...

  7. 【IOS笔记】Event Delivery: The Responder Chain

    Event Delivery: The Responder Chain  事件分发--响应链 When you design your app, it’s likely that you want t ...

  8. 【IOS笔记】Gesture Recognizers

    Gesture Recognizers Gesture recognizers convert low-level event handling code into higher-level acti ...

  9. 【IOS笔记】About Events in iOS

    About Events in iOS Users manipulate their iOS devices in a number of ways, such as touching the scr ...

随机推荐

  1. BZOJ1833或洛谷2602 [ZJOI2010]数字计数

    BZOJ原题链接 洛谷原题链接 又是套记搜模板的时候.. 对\(0\sim 9\)单独统计. 定义\(f[pos][sum]\),即枚举到第\(pos\)位,前面枚举的所有位上是当前要统计的数的个数之 ...

  2. shell脚本返回字符串

    shell脚本的return只能返回数值类型,可是我们很多时候想返回字符串 #!/bin/sh function getStr () { String="very good" ec ...

  3. 原创:Spring整合junit测试框架(简易教程 基于myeclipse,不需要麻烦的导包)

    我用的是myeclipse 10,之前一直想要用junit来测试含有spring注解或动态注入的类方法,可是由于在网上找的相关的jar文件进行测试,老是报这样那样的错误,今天无意中发现myeclips ...

  4. AX_Args

    Args args; FormRun formRun; ; args = new Args(); args.name(formstr(FormName)); args.caller(); args.r ...

  5. Python 使用for...in...和 while 循环 实现8种格式的 九九乘法表

    #九九乘法表 for...in .. #左下角 for i in range(1,10): for j in range(1,i+1): print(' %d×%d=%2d'%(j,i,i*j), e ...

  6. 2017/2/16:自己ajax+json习惯性写法 代码拼接的写法 +json用post提交乱码的原因

    1.先导入jquery的包 2.ajax的写法跟注意点 返回一个list的写法 代码拼接写法: html层: 2.script处 4:在你前面传递参数的时候没有遇到乱码问题的情况下,你使用json并且 ...

  7. MathExam

    MathExam 一.预估与实际 PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟) Planning 计划 575 605 • Est ...

  8. 2019.01.24 bzoj2310: ParkII(轮廓线dp)

    传送门 题意简述:给一个m*n的矩阵,每个格子有权值V(i,j) (可能为负数),要求找一条路径,使得每个点最多经过一次且点权值之和最大. 思路:我们将求回路时的状态定义改进一下. 现在由于求的是路径 ...

  9. php,判断ajax,get,post

    PHP自定义函数判断是否为Get.Post及Ajax提交的方法 /** * 是否是AJAx提交的 * @return bool */ function isAjax(){ if(isset($_SER ...

  10. max10之pll时钟源切换

    问题3:PLL切换功能中,多次切换可能造成PLL锁不定 从现象看clkbadx信号是不影响的,但locked信号一定是有影响的.