标签:
- (IBAction)hideBut:(id)sender { if (self.flg) { [UIView animateWithDuration:0.3 animations:^{ self.meunBaseLayer.transform = CGAffineTransformRotate(self.meunBaseLayer.transform , 3.14); // 缩放是按比例缩放 self.meunBaseLayer.transform = CGAffineTransformScale( self.meunBaseLayer.transform, 0.5, 0.5); }]; self.flg = NO; }else{ [UIView animateWithDuration:0.3 animations:^{ self.meunBaseLayer.transform = CGAffineTransformRotate(self.meunBaseLayer.transform , -3.14); self.meunBaseLayer.transform = CGAffineTransformScale( self.meunBaseLayer.transform, 2, 2); }]; self.flg = YES; } }
1. 在全局声明一个flg标示,用于判断按钮是扩大还是缩放。
2. 在执行视图的过程中添加一个动画。
3. 通过View的transfrom属性改变View的形状已经旋转角度。
CGAffineTransformRotate:视图旋转,根据π值的正负确定旋转的角度。
CGAffineTransformScale:视图缩放,缩放是根据当前视图的比例进行的操作。
标签:
原文地址:http://www.cnblogs.com/daojiao/p/4828566.html