navigationItem的leftBarButtonItem和rightBarButtonItem隐藏
- (void)showEdit {
if (不符合显示条件) {
self.navigationItem.rightBarButtonItem.customView.hidden = YES;
//[self.navigationItem.rightBarButtonItem.customView setAlpha:0.0];
} else{
self.navigationItem.rightBarButtonItem.customView.hidden = NO;
//[self.navigationItem.rightBarButtonItem.customView setAlpha:1.0];
}
}
经过亲自尝试,该种方法并不能实现隐藏和显示功能,于是,尝试用下面这种方法成功解决了问题
- (void)showEdit {
if (符合显示条件) {
if (self.navigationItem.rightBarButtonItem == nil) {
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"编辑" style:UIBarButtonItemStyleDone target:self action:@selector(edit:)];
}
} else{
if (self.navigationItem.rightBarButtonItem) {
self.navigationItem.rightBarButtonItem = nil;
}
}
}
navigationItem的leftBarButtonItem和rightBarButtonItem隐藏的更多相关文章
- leftBarbuttonItem/rightBarButtonItem和leftBarbuttonItems/rightBarButtonItems相关问题
仿写项目的时候,出现了一个Bug:点击右边的"编辑","编辑"变为"完成",左侧出现"全选","删除" ...
- 关于NavigationItem.rightBarButtonItem设置
转自:http://blog.csdn.net/zhuzhihai1988/article/details/7701998 第一种: UIImage *searchimage=[UIImage ima ...
- iOS中navigationItem的titleView如何居中
开发过程中,发现titleview很难居中,通过各种尝试终于找到了解决方法. 首先清楚你个概念: leftBarButtonItem,导航条中左侧button. rightBarButtonItem, ...
- iOS8 自定义navigationItem.titleView
navigationBar其实有三个子视图,leftBarButtonItem,rightBarButtonItem,以及titleView.前两种的自定义请参考http://www.cnblogs. ...
- leftBarButtonItem 的颜色
修改系统:leftBarButtonItem, rightBarButtonItem 的颜色 在你需要修改的页面,ViewDidload()方法里面贴上下面代码 self.navigationCont ...
- IOS 学习 开发 自定义 UINavigationController 导航
文件目录如下:基本导航顺序: root -> First -> Second -> Third.其中,FirstViewController作为 navigation堆栈的rootv ...
- 导航VC的左右item代码
代码控制左右item: UIButton *btnCancel = [UIButton buttonWithType:UIButtonTypeCustom]; btnCancel.frame= ...
- iOS自定义NavigationBar
日常开发中少不了用到UINavigationController,但是很多情况都要自定义NavigationBar.依稀记得自己刚开始也踩了好多坑,凑今天有空,就把想到的写下来.有时间了,考虑再把自定 ...
- iOS学习心得——UINavigationController
UINavigationController和UItableviewController一样也是iOS开发中常用的控件之一,今天就来学习一下它的常见用法. 有人说tab ...
随机推荐
- 开源的分布式事务框架 springcloud Alibaba Seata 的搭建使用 一次把坑踩完。。。
seata的使用 1. Seata 概述 Seata 是 Simple Extensible Autonomous Transaction Architecture 的简写,由 feascar 改名而 ...
- Linux文件与目录管理 cp od chattr lsattr
1:在shell脚本中,一定要使用绝对路径. 2:在根目录下,.和..是完全相同的两个目录. 3:cd - 就相当于撤销,表示回到前面状态所在的目录. 4:mkdir -m 700 test 加&qu ...
- loadRunner运行场景时,事务数为0或是只显示添加的事务的数
脚本编辑好后,不要着急到controller去执行,注意查看Run-time Settings(运行是设置)-->General(常规)-->Miscellaneous(其他)中查看Aut ...
- mac 工作区
https://www.zhihu.com/question/20917614 http://www.bjhee.com/mission-control.html 窗口切换 https://sspai ...
- SpringCloud升级之路2020.0.x版-34.验证重试配置正确性(2)
本系列代码地址:https://github.com/JoJoTec/spring-cloud-parent 我们继续上一节针对我们的重试进行测试 验证针对限流器异常的重试正确 通过系列前面的源码分析 ...
- Chapter 1:Create You First 3D Scene With Three.js
1,各浏览器对WebGL的支持 手机浏览器对WebGL的支持: 书的源码:https://github.com/josdirksen/learning-threejs 第一次用浏览器打开代码可能无法正 ...
- Python--基本数据类型(可变/不可变类型)
目录 Python--基本数据类型 1.整型 int 2.浮点型 float 3.字符串 str 字符串格式 字符串嵌套 4.列表 list 列表元素的下标位置 索引和切片:字符串,列表常用 5.字典 ...
- HMS Core Insights第八期直播预告--创新能力解读
[导读] 在上个月举办的HDC2021华为开发者大会上,全新登场的HMS Core 6向大家展示了包括媒体.图形.连接与通信等领域的众多全新开放能力.如仅用一部RGB摄像头的手机即可完成的3D建模,在 ...
- [nowcoder5668J]Operating on the Tree
考虑令$a_{i}$为i的位置,$p_{i}=0/1$表示第i个点的贡献,那么$p_{x}=0$当且仅当存在与其相邻的点$y$满足$a_{y}<a_{x}$且$p_{y}=1$ 树形dp,定义状 ...
- 洛谷 P7323 - [WC2021] 括号路径(启发式合并)
题面传送门 emmmm----怎么评价这个题嘛...感觉纯论算法,此题根本谈不上难题,不过 WC 时候太智障只拿了个 48pts 就走人了.总之,技不如人,甘拜吓疯( 首先要注意到几件事情: 如果 \ ...