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. 【Xcelsius】在PPT中嵌入水晶易表Xcelsius2008仪表盘

    如果您使用Xcelsius创建了动画图形,并将其保存为 Shockwave® 文件(.swf 文件扩展名).但是往往插入进去之后,会产生一些比较棘手的问题,比如ppt不会自动播放,错误等等.今天把这些 ...

  2. 一道常被人轻视的前端JS面试题(转)

    分享下我曾经出过的一道面试题,此题是我出的一套前端面试题中的最后一题,用来考核面试者的JavaScript的综合能力,很可惜到目前为止的将近两年中,几乎没有人能够完全答对,并非多难只是因为大多面试者过 ...

  3. [Leetcode] Merge Intevals

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

  4. URAL 1057. Amount of Degrees(数位DP)

    题目链接 我看错题了...都是泪啊,不存在3*4^2这种情况...系数必须为1... #include <cstdio> #include <cstring> #include ...

  5. C#中常用的与编码有关的代码

    如何将字符串转化为字符数组? char[] chars=str.ToArray(); 如何将字符串转化为字节数组? Encoding.ASCII.GetBytes(str); Encoding.Uni ...

  6. SDCycleScrollView 滚动视图的使用(广告)

    github库链接https://github.com/gsdios/SDCycleScrollView 无限循环自动图片轮播器(一步设置即可使用) // 网络加载图片的轮播器 cycleScroll ...

  7. CentOS VirtualBox启动虚拟及报错:VirtualBox error: Kernel driver not installed (rc=1908)

    VirtualBox error: Kernel driver not installed (rc=1908) Hi all, Let me first say that this is my fin ...

  8. php关于金额比较引发的问题(转)

    做电子商务的时候一般会涉及到金额的比较,按正常的思路来看用><=这些个符号就可以了.可是要是到程序上来搞这个的话就出大事了.现在看下这段代码: $f = 0.07; var_dump($f ...

  9. Eclipse IDE for C/C++ Developers安装配置详解

    Eclipse IDE for C/C++ Developers安装配置详解(转) 转自:http://hi.baidu.com/ltb6w/item/986532efd712460f570f1ddc ...

  10. HTTP Methods: GET v.s POST

    HTTP works as a request-response protocol between a client and server. A web browser may be the clie ...