一旦按下UI按钮,如何更改UI按钮标题?

时间:2012-01-23 02:59:52

标签: ios5 uibutton

按下btn1后,我无法更改UIButton btn2的标题。当我使用_definition settitle:@"Show Word" forState: UIControlStateNormal时,它会更改原始的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);

}

2 个答案:

答案 0 :(得分:1)

尝试以下方面的内容:

[btn2 setTitle:@"Show Word"]

答案 1 :(得分:0)

你可以这样试试:

[_definitionPressed setTitle:@"Normal State" forState:UIControlStateNormal];
[_definitionPressed setTitle:@"Selected State" forState:UIControlStateHighlighted];