gpt4 book ai didi

iphone - UILabel 无法更新标签文本

转载 作者:行者123 更新时间:2023-11-28 19:18:55 25 4
gpt4 key购买 nike

我是 ios 的新手。我有一个 viewController,其中有一个通知观察器。例如

-(void) myNotificationObFn:(Notification *)noti
{
/* Here i am trying to change the text of UILabel, which is not working.
ie:
NSString *ns = [NSString stringWithFormat:@"%d", 10];
mylabel.text = ns;
*/
}

我该如何解决这个问题?

最佳答案

-(void) myNotificationObFn:(Notification *)noti
{
dispatch_sync(dispatch_get_main_queue(), ^{
NSString *ns = [NSString stringWithFormat:@"%d", 10];
labelfromtag.text = ns;
[labelfromtag setNeedDisplay];
});
}

关于iphone - UILabel 无法更新标签文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10527027/

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