iOS: How to get background thread to redraw view on main thread

好久不见. 提交于 2019-12-06 12:07:06

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 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!