按下 UIbutton 后如何更改 UIbutton 标题? [英] How to change UIbutton title once a UIbutton is pressed?
本文介绍了按下 UIbutton 后如何更改 UIbutton 标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按下 btn1 后,我无法更改 UIButton btn2 的标题.当我使用 _definition settitle:@"Show Word" forState: UIControlStateNormal
时,它会更改原始 btn1.
I am having trouble changing the title of UIButton btn2 once btn1 is pressed. When I use _definition settitle:@"Show Word" forState: UIControlStateNormal
it changes the original btn1.
这是供您查看的代码,
- (IBAction)mynextPressed:(UIButton *)sender {
//Display the string in the label field
[self.WordDisplay setText:vocabulary];
//reset center button with "show word"
[_definitionPressed setTitle:@"Show Word" forState:UIControlStateNormal];
NSLog(@"displaying word: %@", _definitionPressed.titleLabel);
}
推荐答案
尝试以下方式:
[btn2 setTitle:@"Show Word"]
这篇关于按下 UIbutton 后如何更改 UIbutton 标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文