从特定点缩放

我正在使用此代码从特定点进行缩放
CGPoint getCenterPointForRect(CGRect inRect)
{
    CGRect screenRect = [[UIScreen mainScreen] bounds];
    return CGPointMake((screenRect.size.height-inRect.origin.x)/2,(screenRect.size.width-inRect.origin.y)/2);
}

-(void) startAnimation
{
    CGPoint centerPoint = getCenterPointForRect(self.view.frame);
    self.view.transform = CGAffineTransformMakeTranslation(centerPoint.x, centerPoint.y);
    self.view.transform = CGAffineTransformScale( self.view.transform , 0.001, 0.001);
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:kTransitionDuration];
    self.view.transform = CGAffineTransformIdentity;
    [UIView commitAnimations];
}
它不起作用。从特定点进行缩放的正确方法是什么。     
已邀请:
我认为,如果我已经正确地诊断出您的问题,那么您将获得一个缩放动画,其中视图开始很小并且在某个点上,然后缩放并移动到屏幕的中心,就像您想要的那样,但它的开始点在不正确? 首先,观点围绕其中心进行扩展。因此,如果您取出翻译并因此减少了代码,您必须:
self.view.transform = CGAffineTransformMakeScale( 0.001, 0.001);
你的视图最终占据了整个屏幕,然后它将保持在屏幕中间的中心位置,有点像一个很远的地方,你正朝着它前进。 假设您希望它从(x,y)增长并移动到屏幕中心,那么您需要更多类似的东西:
CGPoint locationToZoomFrom = ... populated by you somehow ...;
CGPoint vectorFromCentreToPoint = CGPointMake(
               locationToZoomFrom.x - self.view.center.x,
               locationToZoomFrom.y - self.view.center.y);

self.view.transform = CGAffineTransformMakeTranslation(vectorFromCentreToPoint.x, vectorFromCentreToPoint.y);
self.view.transform = CGAffineTransformScale( self.view.transform , 0.001, 0.001);
其中locationToZoomFrom将成为视图的初始中心,其正常中心将按其框架作为目标。     

要回复问题请先登录注册