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的左下角的点为中心旋转,应该是添加什么样的代码呢?