改变self.editButtonItem.title

 1 - (void)viewDidLoad
 2 {
 3     [super viewDidLoad];
 4     
 5     self.editButtonItem.possibleTitles = [NSSet setWithObjects:@"编辑", @"完成", nil];
 6     self.editButtonItem.title = @"编辑";
 7     self.navigationItem.leftBarButtonItem = self.editButtonItem;
 8 }
 9 
10 - (void)setEditing:(BOOL)editing 
11           animated:(BOOL)animated
12 {
13     [super setEditing:editing animated:animated];
14     
15     if (self.editing) {
16         self.editButtonItem.title = @"完成";
17     } else {
18         self.editButtonItem.title = @"编辑";
19     }
20 }
 1 possibleTitles
 2 The set of possible titles to display on the bar button.
 3 
 4 @property(nonatomic, copy) NSSet *possibleTitles
 5 Discussion
 6 Use this property to provide a hint to the system on how to correctly size the bar button item to be wide enough to accommodate your widest title. Set the value of this property to an NSSet object containing all the titles you intend as possible titles for the bar button item. Use the actual text strings you intend to display.
 7 
 8 This property applies to bar button items placed on navigation bars or toolbars.
 9 
10 Availability
11 Available in iOS 2.0 and later.
12 Related Sample Code
13 AccelerometerGraph
14 Declared In
15 UIBarButtonItem.h

 

转载于:https://www.cnblogs.com/submarinex/archive/2012/11/13/2768640.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值