I AViewController to do a network request, the request needs to be refreshed View, after the end of some of the controls sometimes request more slowly, it will point back button.
1 The request has not come back, how to deal with threading issues.
2 The request has come back, doing UI updates, how to deal with threading issues.
Reply:
it's not about threads' problem
Reply:
Using asynchronous tasks (dispatch_async) it, like upstairs said, this is not primarily a question thread
Reply:
GCD is relatively better asynchronous load data, and then sync refresh UI in the main thread
Reply:
you in the thread's mission is to send the request, regardless of whether the request is successful the request, the county seat should be used to return to the main thread of nested update UI
Reply:
Request has not come back, it would just return to the previous screen.
Request back to being refreshed interface, point the refresh button to have to wait for complete interface (no control), will return to the previous screen.
Request data using a background thread.
Afraid, point interface after the destruction of the back button, then asked to return, that interface is still there, then refresh. For example, you can destroy the interface callback delegate when the request is set to 0, the request came back refreshed interface, determine if the delegate is 0, do not refreshed. Or, when you put a label dealloc interface is set to 0, the request came back label is not the first judge to 0 and then decide whether to refresh.
No comments:
Post a Comment