In my app, I use several tableviews I need to put loading screen when user click on one of cell in tableView. I attempted to put new UIView (activityIndicator and label) and then call
[[self navigationController] pushViewController:newController animated:YES];
then I can display loading screen while new tableView is preparing data. But this approach didn’t quite work, in fact, loading screen didn’t even show up and just stuck at previous tableview until new tableview is ready.
So I attempted the other way, that put loading screen with NSOperation/NSOperationQueue. It works but loading screen comes up a little bit late (showed in middle of working of new tableView).
I want to show loading screen right after user click on cell, how could I resolve this problem?
I would suggest that your data loading code is placed on a background thread and started. Then put up a “loading…” view or something. This keeps the display responsive. When the data loading is finished it can notify the main thread that the data is ready and the main thread can then take down the “Loading …” display.
In other words, read up on using threads when long running tasks such as data loading are required.