解决方法
添加UIActivityIndicatorView作为按钮的子视图:
- // 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];