1. rightBarButtonItem的创建

-(void)initRightBar{
    UIBarButtonItem *done =[UIBarButtonItem rightItemWithText:@"新建优惠" withTextColor:[UIColor nvColorWithf63] target:self action:@selector(gotoCreateCoupon)];
    self.navigationItem.rightBarButtonItem = done;
}

2. 使用UIButton创建UIBarButtonItem

- (UIBarButtonItem *)creatCouponButtonItem {
    UIButton *creatCouponButton = [[UIButton alloc] initWithFrame:CGRectMake(, , , )];
    [creatCouponButton setTitle:@"新建优惠" forState:UIControlStateNormal];
    [creatCouponButton setTitleColor:[UIColor nvColorWithf63] forState:UIControlStateNormal];
    creatCouponButton.titleLabel.font = [UIFont nvFontWithSize14];
    [creatCouponButton addTarget:self action:@selector(gotoCreateCoupon) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:creatCouponButton];
    return buttonItem;
}

UIBarButtonItem的创建的更多相关文章

  1. iOS开发系列--通讯录、蓝牙、内购、GameCenter、iCloud、Passbook系统服务开发汇总

    --系统应用与系统服务 iOS开发过程中有时候难免会使用iOS内置的一些应用软件和服务,例如QQ通讯录.微信电话本会使用iOS的通讯录,一些第三方软件会在应用内发送短信等.今天将和大家一起学习如何使用 ...

  2. iOS--通讯录、蓝牙、内购、GameCenter、iCloud、Passbook等系统服务开发汇总

    iOS开发过程中有时候难免会使用iOS内置的一些应用软件和服务,例如QQ通讯录.微信电话本会使用iOS的通讯录,一些第三方软件会在应用内发送短信等.今天将和大家一起学习如何使用系统应用.使用系统服务: ...

  3. iOS学习26之UINavigationController

    1. UINavigationController 1> 概述 UINavigationController : 导航控制器, 是 iOS 中最常用的多视图控制器之一, 用它来管理多个视图控制器 ...

  4. iOS开发系列通讯录、蓝牙、内购、GameCenter、iCloud、Passbook系统服务开

    --系统应用与系统服务 iOS开发过程中有时候难免会使用iOS内置的一些应用软件和服务,例如QQ通讯录.微信电话本会使用iOS的通讯录,一些第三方软件会在应用内发送短信等.今天将和大家一起学习如何使用 ...

  5. iOS 利用self.navigationItem.backBarButtonItem修改后退按钮文字

    @property(nonatomic,retain) UIBarButtonItem *backBarButtonItem; // Bar button item to use for the ba ...

  6. iOS - UIToolbar

    前言 NS_CLASS_AVAILABLE_IOS(2_0) __TVOS_PROHIBITED @interface UIToolbar : UIView <UIBarPositioning& ...

  7. ios 修改导航条返回按钮

    ios 修改导航条返回按钮 方式一:使用系统的:可以更改系统的文字:以及通过设置导航条的颜色来达到预期的效果 UIBarButtonItem *backBtns = [[UIBarButtonItem ...

  8. IOS中调用系统的电话、短信、邮件、浏览功能

    iOS开发系列--通讯录.蓝牙.内购.GameCenter.iCloud.Passbook系统服务开发汇总 2015-01-13 09:16 by KenshinCui, 26990 阅读, 35 评 ...

  9. Swift 全功能的绘图板开发

    要做一个全功能的绘图板,至少要支持以下这些功能: 支持铅笔绘图(画点) 支持画直线 支持一些简单的图形(矩形.圆形等) 做一个真正的橡皮擦 能设置画笔的粗细 能设置画笔的颜色 能设置背景色或者背景图 ...

随机推荐

  1. java实现文件上传--flash上传

    1.http请求的头信息是“application/octet-stream”,request body 是二进制的flash图片流 2.把流中的信息读入到文件中 代码如下,代码分三个部分: ---- ...

  2. Diophantus of Alexandria[HDU1299]

    Diophantus of Alexandria Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Ot ...

  3. BZOJ3726 : PA2014Final Wykladzina

    从上到下枚举下底边,维护$a[i]$表示$i$向上延伸多少距离里面没有坏点,$b[i]$表示$i$向上延伸多少距离里面最多只有1个坏点. 设$l0[i],r0[i]$表示以$a[i]$为最小值,往左往 ...

  4. 【转】Android之自定义Adapter的ListView

    http://www.cnblogs.com/topcoderliu/archive/2011/05/07/2039862.html 在开发中,我们经常使用到ListView这个控件.Android的 ...

  5. Darkest page of my coding life

    The code i wrote a while ago recently caused a disaster and as I reviewed it I found it is the silli ...

  6. [Leetcode] Merge Intevals

    Question: Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3], ...

  7. linux 下如何打开core dump文件开关

    dump文件可以在程序crash时,方便我们查看程序crash的地方和上下文信息.在window下,要能生成dump文件,需要自己编写相应的代码.不过现在网上可以找到相应的代码,只要把它下载后然后加到 ...

  8. Flex Vector使用(转)

    从前(Flex SDK 4.0 以前版本)创建 Vector 实例一定要如下所示,这样的语法使我们在构造 Vector 对象时无法指定元素: var v:Vector.<T> = new ...

  9. Redhat5.8 环境下编译安装 Redis 并将其注册为系统服务

    系统环境: $ cat /etc/issueRed Hat Enterprise Linux Server release 5.8 (Tikanga)Kernel \r on an \m 1. 下载安 ...

  10. PHP的学习--cookie和session--来自copy_02

    PHP的学习--cookie和session   最近读了一点<PHP核心技术与最佳实践>,看了cookie和session,有所收获,结合之前的认识参考了几篇博客,总结一下-- 1. P ...