且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iOS:如何获取后台线程以在主线程上重绘视图

更新时间:2023-02-06 09:03:14

我发现了解决方案,并真正希望这对某人有帮助...

I discovered the solution and truly hope this will help someone...

        if (success) 
        {   

            if ([parser.currentValue isEqualToString:@"G"])

            // Make the changes here - start
            dispatch_queue_t main_queue = dispatch_get_main_queue();
            dispatch_async(main_queue, ^{
            thirdView.image = greenTick.jpg;
            [secondView addSubview:thirdView];
            });
            // Make the changes here - end
        } 
        else 
        {
            NSLog(@"Error parsing document!");
        }
} 
// Remove performSelectorOnMainThread