Delay when updating view in the completionHandler of an async HTTP request

后端 未结 3 1353
生来不讨喜
生来不讨喜 2021-01-06 14:46

In my app when the user presses a button I start a HTTP asynchronous request (using [NSURLConnection sendAsynchronousRequest...]) and change the text of U

3条回答
  •  死守一世寂寞
    2021-01-06 15:11

    You can try to create a method that sets the text, and inside the block you call:

            [self performSelectorOnMainThread:@selector(mySelector) withObject:nil waitUntilDone:NO];
    

    The selector will call and executed on main thread. Hope this help....

提交回复
热议问题