当设置按钮标题给出警告时,uibutton可能无法响应-settitle

时间:2012-04-21 12:44:58

标签: ios uibutton

当尝试将文本设置为按钮获取警告时,UIButton可能无法响应-'settitle'。

以下代码行。

[firstButton setTitle:[buttonArray objectAtIndex:0]];

[secondbutton setTitle:[buttonArray objectAtIndex:i+index]];

2 个答案:

答案 0 :(得分:4)

尝试:

[firstButton setTitle:[buttonArray objectAtIndex:0] forState:UIControlStateNormal];

[secondbutton setTitle:[buttonArray objectAtIndex:i+index] forState:UIControlStateNormal];

答案 1 :(得分:1)

整个方法签名是 - setTitle:forState:

forState:是方法名称的一部分,而不是可选参数。