代码如下,很简单,做一个当前view的缩放动画
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
self.view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.5f, 0.5f);
[UIView commitAnimations];
但现在缩放的中心点是view的中心点,达不到我的要求,可不可以动态的确定缩放中心点?
需要用CALayer 设置 AnchorPoint
(0,0) 为左上角,(0,1) 为左下角,
(1, 0)右上, (1,1) 右下
每次改了AnchorPoint, frame 都会改变,所以要重置frame.
#import
CGRect oldFrame = self.view.frame ;
[self.view.layer setAnchorPoint: CGPointMake(0.0f, 0.0f) ];
self.view.frame = oldFrame;
试试CALayer,这个是改变真正的视图的