2012-01-23 94 views
1

一旦按下btn1,我無法更改UIButton btn2的標題。當我使用_definition settitle:@"Show Word" forState: UIControlStateNormal它改變了原來的btn1。如何在按下UIbutton時更改UIbutton標題?

這裏是您的評論的代碼,

- (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); 

} 
+0

簡單地檢查你的筆尖文件用於連接第二個按鈕的插座及其屬性。它看起來像你的第二個按鈕的插座設置與第一個按鈕的屬性。 – Bhavin

回答

1

試試沿着線:

[btn2 setTitle:@"Show Word"] 
0

ü可以試試這個方法:

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