Fork me on GitHub

ios缩放动画

http://www.iloss.me/?p=944

直接贴代码了:

- (CGAffineTransform)transformForOrientation {
	UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
	if (UIInterfaceOrientationLandscapeLeft == orientation) {
		return CGAffineTransformMakeRotation(M_PI*1.5);
	} else if (UIInterfaceOrientationLandscapeRight == orientation) {
		return CGAffineTransformMakeRotation(M_PI/2);
	} else if (UIInterfaceOrientationPortraitUpsideDown == orientation) {
		return CGAffineTransformMakeRotation(-M_PI);
	} else {
		return CGAffineTransformIdentity;
	}
}

用法:(这里用一个button控件来实现)
UIButton *transformButton;
//从小变大:

	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationDuration:0.2];
	[UIView setAnimationDelegate:self];
	transformButton.transform = CGAffineTransformScale([self transformForOrientation], 1.1, 1.1);
	[UIView commitAnimations];

同理
//大变小
transformButton.transform = CGAffineTransformScale([self transformForOrientation], 0.001, 0.001);

posted on 2012-02-16 09:22  pengyingh  阅读(4975)  评论(0编辑  收藏  举报

导航