dingbat/nsrails

Is there a way to show UIActivityIndicatorView?

tomoyuki28jp opened this issue · 4 comments

NSRails does not provide delegate methods and NSURLRequest is not accessible from other classes. Is there a way to show UIActivityIndicatorView while loading data from a web server?

I would recommend to use the asynchronous block requests. Start animating your activity indicator view before making the request, and stop it in the completion handler. The completion blocks are called on the main thread, so you can update UI in them.

If you're interested in UIApplication's status bar network activity indicator, this is actually built-in to NSRails:

[NSRConfig defaultConfig].managesNetworkActivityIndicator = YES;

(Even takes care of concurrent requests that would otherwise turn the indicator off before another is complete.)

Thanks for your quick response (as always), @dingbat!
I'll try the way and drop a comment here later.

Sorry, I was misunderstanding something. This was a very basic (beginner's) question.

[activityIndicatorView startAnimating]; and [request sendAsynchronous:...] just works fine.

Thanks for your help and great work!

No problem.