通过撰写和阅读UIButton
的标题,我遇到了麻烦。
我的问题:
// If I execute this line of code everything works fine, the title gets changed in the UI
[self.lastButtonPressed setTitle:stringDate forState:UIControlStateNormal];
// In the next line of code I want to read the title I've set before, but everything I get is the title of the UIButton before I changed the title.
NSString *myText = [self.lastButtonPressed.titleLabel.text];
[UIButton setTitle]
是否可能被异步调用?如果是,是否有可能使此呼叫同步?
答案 0 :(得分:5)
您可能希望currentTitle
不是titleLabel.text
。或许titleForState:UIControlStateNormal
。