一旦按下UI按钮,如何更改UI按钮标题? [英] How to change UIbutton title once a UIbutton is pressed?
本文介绍了一旦按下UI按钮,如何更改UI按钮标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
按下btn1后,我无法更改UIButton btn2的标题。当我使用 _definition settitle:@Show WordforState: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"]
这篇关于一旦按下UI按钮,如何更改UI按钮标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文