使用动画块从中心缩放UIImageView

| 我正在使用以下内容按比例放大图像,但它是从其左上角开始缩放的,如何从中心开始缩放
[UIView animateWithDuration:duration delay:delay options:options 
                 animations:^{
                     myImageView.frame = frame;
                     myImageView.alpha = alpha;
                 }
                 completion:^(BOOL finished) {

                 }
 ];
已邀请:
[UIView animateWithDuration:0.5 
                      delay:0
                    options:UIViewAnimationOptionBeginFromCurrentState
                 animations:(void (^)(void)) ^{
                     myImageView.transform=CGAffineTransformMakeScale(1.2, 1.2);
                 }
                 completion:^(BOOL finished){
                     myImageView.transform=CGAffineTransformIdentity;
                 }];
这将完美地工作 祝好运
尝试这个:
[UIView animateWithDuration:2
   animations:^{
       float zoomScal = 5; //want 5x zoom
       CGPoint CenterPoint = CGPointMake(200, 300); // want center point to this
       imgArtifactImage.frame = CGRectMake(- CenterPoint.x * (zoomScal-1),- CenterPoint.y * (zoomScal-1),self.view.frame.size.width * zoomScal,self.view.frame.size.height * zoomScal);
} completion:^(BOOL finished){}];
它为我工作。
这可以是放大图像的动画块 这里是theView U可以使用uiimageview
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:GROW_ANIMATION_DURATION_SECONDS];
theView.transform = CGAffineTransformMakeScale(1.2, 1.2);

[UIView commitAnimations];

要回复问题请先登录注册