//让控件以 [self setAnchorPoint:CGPointMake(0, 0) forView:smallImg];为中心点旋转
//CGPointMake(0, 0) 控件的左上角为中心点
//CGPointMake(1, 1) 控件的右下角为中心点
- (void)setAnchorPoint:(CGPoint)anchorPoint forView:(UIView *)view
{
CGPoint oldOrigin = view.frame.origin;
view.layer.anchorPoint = anchorPoint;
CGPoint newOrigin = view.frame.origin;
CGPoint transition;
transition.x = newOrigin.x - oldOrigin.x;
transition.y = newOrigin.y - oldOrigin.y;
view.center = CGPointMake (view.center.x - transition.x, view.center.y - transition.y);
}
时间: 2024-10-05 23:37:01