0

我有以下代码:

 UIBarButtonItem *promoteButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonItemStyleBordered target:self action:@selector(promoteToInstagram:)];
    [promoteButton setTitle:@"Promote"];
    self.navigationItem.rightBarButtonItem = promoteButton;

我正在尝试创建一个带有自定义标题的 UIBarButtonItem。为什么上面说取消而不是推广?

关于如何解决这个问题的任何想法?

4

2 回答 2

1

也许使用正确的初始化程序?

- (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action
于 2013-02-10T10:18:48.013 回答
0
UIBarButtonItem  btnSort = [[UIBarButtonItem alloc]initWithTitle:@"Descending" style:UIBarButtonItemStyleBordered target:self action:@selector(pressAscending)];
    [[self navigationItem] setRightBarButtonItem:btnSort];
于 2013-02-10T10:20:46.657 回答