How to set activity indicator on custom button in iphone

I am new to iPhone development. I want to set an activity indicator that loads on my custom button. Please guide me. (Example: Application Store β†’ Search β†’ Show 25 more (when pressed)).

+7
ios iphone button
source share
1 answer

Add UIActivityIndicatorView as a sub-button of the button:

 // Create spinner UIActivityIndicatorView *myIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; // Position the spinner [myIndicator setCenter:CGPointMake(myButton.frame.size.width / 2, myButton.frame.size.height / 2)]; // Add to button [myButton addSubview:myIndicator]; // Start the animation [myIndicator startAnimating]; 
+15
source share

All Articles