从发送者获取UIButton文本

11

我怎样才能获取UIButton中的文本?

-(IBAction)clicked:(id)sender

方法是什么?

谢谢

1个回答

43

这个怎么样:

- (IBAction)clicked:(id)sender {
  UIButton *button = (UIButton *)sender; 
  NSString *buttonTitle = button.currentTitle;
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接