2011-08-20 83 views

回答

2

是的,你可以設置視圖的transform。特別是CGAffineTransformMakeScale可能對你有用。

+0

能否請您詳細闡述它??笏在按鈕acotins寫,如果我有一個UIView * MyView的和一個UIButton *幹訓局? –

+0

@Sadumerry:例如,'myView.transform = CGAffineTransformMakeScale(1.5,1.5);' – jtbandes

+0

FOR詳細代碼見下面的答案我已經提供.. –

0

上面的代碼其實是對的!但在這裏,我只是闡述it..as我用什麼..

- (IBAction爲)zoomin:(ID)發送{

self.view.transform = CGAffineTransformMakeScale(.5,.5); 
[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:0.9]; 
//self.view.transform = CGAffineTransformMakeScale(1.5,1.5); 
[UIView commitAnimations]; 

} - (IBAction爲)縮小(ZoomOut):(ID)發送者{

self.view.transform = CGAffineTransformMakeScale(1,1); 
[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDuration:0.9]; 
//self.view.transform = CGAffineTransformMakeScale(1.5,1.5); 
[UIView commitAnimations]; 

}