This should be easy: When calling a didSelectRowAtIndexPath, I run a complex method, that downloads the contents of a URL, parses it, and put the result in the various properties. In the Simulator, and on a device in a WiFi situation, everything is just fine. However, on a device on a slower network, it just takes some time to process this all. Therefore, I want to display a spinner in the cell of the selected row, to comfort the user in the idea that something is going on.
My problem is, that the spinner only seems to appear during the animated transition between the view in which a row was selected and the subsequent view.
I want the spinner to show during the downloading, the parsing and the animation.
I tried this:
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
myCustomCell = (MyCustomCell*)[tableView cellForRowAtIndexPath:indexPath];
[myCustomCell.spinner startAnimating];
return indexPath;
}
and
- (NSIndexPath *)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
myCustomCell = (EventCell*)[tableView cellForRowAtIndexPath:indexPath];
[myCustomCell.spinner startAnimating];
[self myVerySlowMethod];
return indexPath;
}
however, the spinner seems to be shown only in between the two views.
I tested this on a Real Device, and I never got the spinner to show.
Is this:
a) because the myVerySlowMethod is fast enough? b) because the didSelectRowAtIndexPath will first process everything and then do the display part or c) I should study all the well-written Programming Guides before I bother you?
Any answer is appreciated.