views:

485

answers:

2

I don't want to just use a UIActivityIndicatorView -- I want the spinning animation that you see in the Maps application while you are doing a CoreLocation lookup.

Do I have to create my own animation, or is there an easy way?

edit: I'm referring to the standard Apple "Maps" application. Specifically I'm referring to the animation that occurs in the button in the UIToolbar at the bottom of the page, when you press the button to find your location.

There are two components to this animation -- first the "button push" animation, and then the spinning "busy" animation. I presume the latter is done with a UIActivityIndicatorView, but I was hoping that the whole thing was packaged together into a single control of some sort.

+3  A: 

You might be thinking of the network activity indicator, which can be set like

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

EDIT: Thanks for the clarification: The Map app is using a UIBarButtonItem with a UIActivityIndicatorIndicator as the custom view. You can do something along the lines of:

UIActivityIndicatorView *indicator =
    [[UIActivityIndicatorView alloc]
        initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView:indicator];
[indicator startAnimating];
[indicator release];
notnoop
Thank you, but no. I clarified my question, please see above.
Amagrammer
msaeed: That's still not what I'm looking for, but I appreciate your efforts. It sounds like what I need is a complex object that acts as a regular button normally, but on being pushed switches to displaying the animation instead. Perhaps it was too much to hope that Apple gave us an object that put it all together.
Amagrammer
A: 

Hey, why don't you just put an indicator view on top of a button and display it only when a location is in progress? I did exactly that and it does work perfectly!

Martin
Yes, that's basically what I'm going to do, since the simple solution I was looking for doesn't seem to exist. An hour of work instead of 5 minutes -- could be worse.
Amagrammer