2010-03-18 63 views

回答

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]; 
+0

感谢。是的,它是如何工作的,我如何改变指标的位置。现在它加载按钮的左上角。 – Pugal 2010-03-18 11:55:22

+0

查看更新的答案 – pheelicks 2010-03-18 12:07:47

+1

谢谢,它工作正常。 – Pugal 2010-03-18 12:33:19