gpt4 book ai didi

ios - UIButton setTitle 不会立即更改标题

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:28:01 24 4
gpt4 key购买 nike

我在编写和读取 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

关于ios - UIButton setTitle 不会立即更改标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24532128/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com