2015-11-02 135 views
0

我在我的viewcontroller中有一個UIView。它有框架(34,250,253,193),它是水平中心。我想放大和縮小這個UIView。隨着放大,它與中心工作正常。但是,縮小後,它的工作不正確。目前,視圖從右向左縮小。我不想要這個。我希望它縮小與中心。縮小中心UIView動畫

這是我的代碼

-(void)zoomin:(UIView*)view { 
    view.transform = CGAffineTransformMakeScale(0.1,0.1); 
    [UIView animateWithDuration:2.0 animations: ^{ 
     view.transform = CGAffineTransformMakeScale(1,1); 
    }]; 
} 

-(void)zoomout:(UIView*)view { 
    view.transform = CGAffineTransformMakeScale(1,1); 
    [UIView animateWithDuration:2.0 animations: ^{ 
     view.transform = CGAffineTransformMakeScale(0.1,0.1); 
    }]; 
} 
+0

誰能幫幫我?請 – Duyklinsi

回答

0

的問題是,你的代碼,只要你表現出它,完美的作品:

enter image description here

因此它遵循邏輯,如果有一個問題,它是由你有而不是顯示。但是既然你沒有展示出來,除了猜測之外,沒有辦法知道它是什麼。