7

我是 iPhone 开发的新手。我想设置一个加载在我的自定义按钮上的活动指示器。请指导我。(例如:App store --> Search --> Show 25 more (on click))。

4

1 回答 1

15

添加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];
于 2010-03-18T11:20:06.073 回答