我有一个uibutton,我正在将其标题更改为我从webservice收到的数据我已经打印了uibutton当前磁贴和我要显示的标题,但它没有更改按钮标题
NSString *str = [NSString stringWithFormat:@"%@",[[status objectForKey:@"detail"] valueForKey:@"goalDetailText"]];
[goalButton setTitle:str forState:UIControlStateSelected];
NSLog(@"title is %@ and value is %@",goalButton.currentTitle,str); [goalButton setTitle:str forState:UIControlStateSelected];
控制台是
2013-11-25 12:13:04.666 = sdad [3389:1003] title is Loading ... and value is Learn and practise how to minimize "emotional eating"
但问题是uibutton标题需要时间来改变标题就像一个龙时间,但我已经检查了webservice的值不是null并且它的打印绝对没问题,但是它的设置花费了太多时间。我的项目是在IOS7上。
答案 0 :(得分:0)
如果您的按钮状态更改为正常,则在您点按内部后,您需要使用UIControlStateNormal
状态作为标题:
[goalButton setTitle:str forState:UIControlStateNormal];