2010-03-18 66 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