关于NavigationItem.rightBarButtonItem设置
转自:http://blog.csdn.net/zhuzhihai1988/article/details/7701998
第一种:
UIImage *searchimage=[UIImage imageNamed:@"search.png"];
UIBarButtonItem *barbtn=[[UIBarButtonItem alloc] initWithImage:nil style:UIBarButtonItemStyleDone target:self action:@selector(searchprogram)];
barbtn.image=searchimage;
self.navigationItem.rightBarButtonItem=barbtn;
这种设置出来的外观不好控制
第二种:
UIButton*rightButton = [[UIButtonalloc]initWithFrame:CGRectMake(0,0,30,30)];
[rightButtonsetImage:[UIImageimageNamed:@"search.png"]forState:UIControlStateNormal];
[rightButtonaddTarget:selfaction:@selector(searchprogram)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem*rightItem = [[UIBarButtonItemalloc]initWithCustomView:rightButton];
[rightButton release];
self.navigationItem.rightBarButtonItem= rightItem;
[rightItem release];
这种图片将填满button,大小可控
第三种:
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(methodtocall:) ];
如何让navigationItem.rightBarButtonItem隐藏消失?
self.navigationItem.rightBarButtonItem=nil;
即可实现
关于NavigationItem.rightBarButtonItem设置的更多相关文章
- navigationItem.rightBarButtonItem 设置背景图片,颜色更改解决的方法
self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@& ...
- navigationItem的设置和titleView的设置
设置导航栏中间的标题 self.navigationItem.title = @"title"; 设置导航栏的主题颜色 self.navigationBar.barTintColo ...
- iOS 将navigationItem.titleView设置为自定义UISearchBar (Ficow实例讲解)
这篇文章可以解决以下问题: 1.将searchBar设置为titleView后,无法调整位置的问题 : 2.searchBar的背景色无法设置为透明色的问题: 3.searchBar输入框内用户输入的 ...
- IOS navigationItem 设置返回button,title图片和rightBarButtonItem
1.自己定义返回button UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" st ...
- 【iOS开发-22】navigationBar导航条和navigationItem设置:基本搞定导航条上的文字和按钮以及各种跳转
http://blog.csdn.net/weisubao/article/details/39646739?utm_source=tuicool&utm_medium=referral (1 ...
- 设置导航栏 self.navigationItem.titleView 居中
喜欢交朋友的加:微信号 dwjluck2013-(void)viewDidLayoutSubviews{ [self setDisplayCustomTitleText:@"每日头条&quo ...
- navigationItem的leftBarButtonItem和rightBarButtonItem隐藏
- (void)showEdit { if (不符合显示条件) { self.navigationItem.rightBarButtonItem.customView.hidden = YES; // ...
- leftBarbuttonItem/rightBarButtonItem和leftBarbuttonItems/rightBarButtonItems相关问题
仿写项目的时候,出现了一个Bug:点击右边的"编辑","编辑"变为"完成",左侧出现"全选","删除" ...
- IOS 设置导航栏
//设置导航栏的标题 self.navigationItem setTitle:@"我的标题"; //设置导航条标题属性:字体大小/字体颜色…… /*设置头的属性:setTitle ...
随机推荐
- html5开放资料
http://www.cnblogs.com/tim-li/archive/2012/08/06/2580252.html KineticJS教程(12) 摘要: KineticJS教程(12) 作者 ...
- python中in在list和dict中查找效率比较
转载自:http://blog.csdn.net/wzgbm/article/details/54691615 首先给一个简单的例子,测测list和dict查找的时间: ,-,-,-,-,,,,,,] ...
- 【FinacialKnowledge】财务报表及名词解释
1.财务报表 以下三张表为:资产负债表.利润表.现金流量表 ...
- 基于CUDA的粒子系统的实现
基于CUDA的粒子系统的实现 用途: 这篇文章作为代码实现的先导手册,以全局的方式概览一下粒子系统的实现大纲. 科普: 对粒子进行模拟有两种基本方法: Eulerian(grid-based) met ...
- c中的static
static的作用 1)保持变量值:在函数体,一个被声明为静态的变量在这一函数中可以维持其值.这句话可能描述不太准确,大家看下面这个例子吧. void staticLocalVar() { stati ...
- log4j 日志 配置 学习
1.用的flume-log4j avrosource的整合 2.学习如何指定类打印日志 #log4j.rootLogger=INFO,flume 这个是将全部的日志会打印出来 log4j.logge ...
- PHP中的一些新特性
PHP 5.6 1.可以使用表达式定义常量 https://php.net/manual/zh/migration56.new-features.php 在之前的 PHP 版本中,必须使用静态值来定义 ...
- php调试利器Xhprof的安装与使用
一.安装xhprof wget http://pecl.php.net/get/xhprof-0.9.4.tgz tar -zxvf xhprof-0.9.4.tgz cd xhprof-0.9.4/ ...
- mybatis启动报错Result Maps collection already contains value forxxx
ssm搭建过程中启动tomcat,报错: Cause: java.lang.IllegalArgumentException: Result Maps collection already conta ...
- Java数据库表自动转化为PO对象
本程序简单实现了数据库内省,生成PO对象. 数据库内省有如下两种实现方式: 通过mysql元表 通过desc table,show tables等命令 import java.io.IOExcepti ...