[英]UIButton setTitle doesn't change title immediately
我在編寫和閱讀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]
是否有可能被稱為異步方法? 如果是,是否有可能使此呼叫同步?
您可能需要currentTitle
而不是titleLabel.text
。 或titleForState:UIControlStateNormal
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.