views:

362

answers:

1

Hi,

I am new to iphone development. I want to set an activity indicator which is loaded on my custom button. please guide me.(Example: App store --> Search-->Show 25 more(on click)).

Thanks.

+6  A: 

Add the Activity indicator as a subview of the button:

// Create spinner
UIActivityIndicatorView *myIndicator = [[UIActivityIndicatorView alloc] 
  initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];

// Position the spinner
[myIndicator setCenter:CGPointMake(50.0, 30.0)];

// Add to button
[myButton addSubview:myIndicator];

// Start the animation
[myIndicator startAnimating];
pheelicks
Thanks. Yeah it works, How do i change the position of the indicator. Now its loading top left of the button.
Pugal Devan
See updated answer
pheelicks
Thanks, It works fine.
Pugal Devan