Please see my answer to this question about “label rotation around an arbitrary point” for a more detailed explanation of the use of an anchor point during rotation (ignoring keyframe animation answers because they are more complicated and not “the right tool for this job”, even if the answers are they say).
: ( ) .
: ,
( ) , . , . , ( ). , . Layer Geometry and Transforms ( ) .
, ( UIView Core Animation UIView-):
#define DEGREES_TO_RADIANS(angle) (angle/180.0*M_PI)
- (void)rotateView:(UIView *)view
aroundPoint:(CGPoint)rotationPoint
duration:(NSTimeInterval)duration
degrees:(CGFloat)degrees {
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
[rotationAnimation setDuration:duration];
CGPoint anchorPoint = CGPointMake((rotationPoint.x - CGRectGetMinX(view.frame))/CGRectGetWidth(view.bounds),
(rotationPoint.y - CGRectGetMinY(view.frame))/CGRectGetHeight(view.bounds));
[[view layer] setAnchorPoint:anchorPoint];
[[view layer] setPosition:rotationPoint];
CATransform3D rotationTransform = CATransform3DMakeRotation(DEGREES_TO_RADIANS(degrees), 0, 0, 1);
[rotationAnimation setToValue:[NSValue valueWithCATransform3D:rotationTransform]];
[[view layer] addAnimation:rotationAnimation
forKey:@"rotateAroundAnchorPoint"]
}