I am using the following to scale image up but it's scaling from it's left top point, how can I make the scale from center
[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;
}];
this will work perfectly
Good Luck
Try this:
[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){}];
It's working for me.
this can be the block of animation for the scale up the image
here as theView U Can Use the uiimageview
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:GROW_ANIMATION_DURATION_SECONDS];
theView.transform = CGAffineTransformMakeScale(1.2, 1.2);
[UIView commitAnimations];