关于Navigation的BarButtonItem的
(ios6.1)有两个controller在navigation stack里,A和B。A是B的previous view controller,现在top-level controller是B。要自定义B的backBarButtonItem。
在B的viewDidLoad里添加:
//chage navigationBarButton
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"房间选择" style:UIBarButtonItemStyleDone target:nil action:nil];
[self.navigationItem setBackBarButtonItem:backButtonItem];
试了,结果还是默认的back按钮。
UINavigationController Class Reference中有段话:
The bar button item on the left side of the navigation bar allows for navigation back to the previous view controller on the navigation stack. The navigation controller updates the left side of the navigation bar as follows:
- If the new top-level view controller has a custom left bar button item, that item is displayed. To specify a custom left bar button item, set the leftBarButtonItem property of the view controller’s navigation item.
- If the top-level view controller does not have a custom left bar button item, but the navigation item of the previous view controller has a valid item in itsbackBarButtonItem property, the navigation bar displays that item.
- If a custom bar button item is not specified by either of the view controllers, a default back button is used and its title is set to the value of the title property of the previous view controller—that is, the view controller one level down on the stack. (If there is only one view controller on the navigation stack, no back button is displayed.)
1、如果B视图有一个自定义的左侧按钮(leftBarButtonItem),则会显示这个自定义按钮;
2、如果B没有自定义按钮,但是A视图的backBarButtonItem属性有自定义项,则显示这个自定义项;
3、如果前2条都没有,则默认显示一个后退按钮,后退按钮的标题是A视图的标题,或者默认
try again,在A中的ViewDidLoad中定义backButtonItem:
//chage navigationBarButton
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"房间选择" style:UIBarButtonItemStyleDone target:nil action:nil];
[self.navigationItem setBackBarButtonItem:backButtonItem];
发现B中的backBarButtonItem改变了!!!
如果在B中custom一个UIbarButtonItem,赋值给self.navigationItem.leftBarButtonItem,那么这个UIBarButtonItem将替换backBarButtonItem按钮。
关于Navigation的BarButtonItem的的更多相关文章
- WPF仿Word头部格式,涉及DEV RibbonControl,NarvbarControl,ContentPresenter,Navigation
时隔1个月,2015/06/17走进新的环境. 最近一个星期在学习仿Word菜单栏的WPF实现方式,废话不多说,先看一下效果. 打开界面后,默认选中[市场A],A对应的菜单栏,如上图, 选择[市场B] ...
- arcgis api for js共享干货系列之二自定义Navigation控件样式风格
arcgis api for js默认的Navigation控件样式风格如下图: 这样的风格不能说不好,各有各的爱好,审美观,这里也不是重点,这里的重点是如何自定义一套自己喜欢的样式风格呢:自己自定义 ...
- The Safe Navigation Operator (&.) in Ruby
The most interesting addition to Ruby 2.3.0 is the Safe Navigation Operator(&.). A similar opera ...
- Unity3D 导航网格自动寻路(Navigation Mesh)
NavMesh(导航网格)是3D游戏世界中用于实现动态物体自动寻路的一种技术,将游戏中复杂的结构组织关系简化为带有一定信息的网格,在这些网格的基础上通过一系列的计算来实现自动寻路..导航时,只需要给导 ...
- ABP理论学习之导航(Navigation)
返回总目录 本篇目录 创建菜单 注册导航提供者 展示菜单 每一个web应用在页面之间都有一些要导航的菜单.ABP提供了公用的基础设施来创建菜单并将菜单展示给用户. 创建菜单 一个应用可能由不同的模块组 ...
- Sharepoint学习笔记—ECM系列—文档列表的Metedata Navigation与Key Filter功能的实现
如果一个文档列表中存放了成百上千的文档,想要快速的找到你想要的还真不是件容易的事,Sharepoint提供了Metedata Navigation与Key Filter功能可以帮助我们快速的过滤和定位 ...
- iOS第八课——Navigation Controller和Tab bar Controller
今天我们要学习Navigation Controller和Tab bar Controller. Navigation Controller是iOS编程中比较常用的一种容器,用来管理多个视图控制器. ...
- navigation和tabbar上的文字.图片 自定义
[[UITabBarItem appearance] setTitleTextAttributes:@{ UITextAttributeTextColor : [UIColor blackColor] ...
- navigation controller
一.程序框架 1.程序结构
随机推荐
- CentOS7 网络管理相关命令
contos7 网卡配置文件自动识别ifcfg开头的文件(包括目录) CentOS7网卡命名规则: CentOS 7 开始对于网卡的编号则有另一套规则, 网卡的界面代号现在与网卡的来源有关,基本上的网 ...
- ubuntu 上安装 NASM 汇编开发工具
一般系统自带NASM可通过 输入 nasm -version 检查,若是没有 可用下述指令安装: sudo apt-get install nasm 安装过程执行完毕后 再次输入 : nasm -ve ...
- PHP如何关闭notice级别的错误提示
1.在php.ini文件中改动error_reporting改为:error_reporting=E_ALL & ~E_NOTICE2.如果你不能操作php.ini文件,你可以使用如下方法在你 ...
- js 页码分页的前端写法
<script type="text/javascript"> var curPage = 1;//当前页码 var total;//总页数 $(function () ...
- NLP 自然语言处理
参考: 自然语言处理怎么最快入门:http://www.zhihu.com/question/ 自然语言处理简介:http://wenku.baidu.com/link?url=W6Mw1f-XN8s ...
- php的字符串处理函数
Strpos($str,”img”); //返回字符串的位置 Substr($str,int start,int length); 使用这两个函数可以截取字符串
- ThinkPHP 3.2.3 数据缓存与静态缓存
ThinkPHP 3.2.3 中手册中数据缓存的地址是:http://www.kancloud.cn/manual/thinkphp/1835 静态缓存的地址是:http://www.kancloud ...
- 动态给drawable上色
只加载一个资源,然后在运行的时候通过ColorFilter进行上色 public Drawable colorDrawable(Resources res, @DrawableRes int draw ...
- 奥迪--A6L
-型号:A6L -价格:42-75W -动力:1.8T/2.5L/3T -变速箱:7挡双离合/CVT无级变速/7挡双离合 -长宽高:5.04,1.87,1.47 -油箱:75L -发动机:EA888 ...
- only for equality comparisons Hash Index Characteristics
http://dev.mysql.com/doc/refman/5.7/en/index-btree-hash.html Hash Index Characteristics Hash indexes ...