define PI 3.14159265
-(void)rotation
{
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
animation.fromValue = [NSNumber numberWithFloat:0];
animation.toValue = [NSNumber numberWithFloat:-PI/4];
animation.duration = 1.0f;
[view.layer addAnimation:animation forKey:nil];
}
这段代码可以让这个view逆时针旋转45度 但是以为这个view的中心点为中心旋转的,如果我想以这个view的左下角的点为中心旋转,应该是添加什么样的代码呢?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
小伙看你根骨奇佳,潜力无限,来学PHP伐。