views:

33

answers:

1

In my application i load at startup the distance between user location and a known 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?

+1  A: 

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).

Michael Kessler
i have another idea, i set [indicator startAnimating] in viewDidLoad e then i set [indicator stopUpdating] in method that update the geographic location before distanceShow.text = [NSString stringWithFormat:@"%0.f",distance];and works!!;)
Claudio