In my application i load at startup the distance between user location and a k开发者_如何转开发nown point; I want to show at startup an activity indicator with a label "Loading" that then disappears to show the distance. How can I do?
If you build your views programmatically then this is how you instantiate the activity indicator view:
UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
If you use the IB then it is exactly like adding any other view...
In order to start animating use the [activityIndicatorView startAnimating];
method.
In order to stop - use the [activityIndicatorView stopAnimating];
.
In order to hide the label and the activity indicator together just put the inside an additional view (it might be full-screen half transparent view) and show/hide this view instead of label and indicator view separately.
This way you will also disable all the touchable UI elements (actually, you will hide these by the half-transparent loading view).
精彩评论