本文介绍了UIImageView使用动画块从中心缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下内容来缩放图像,但它从左上角开始缩放,如何从中心缩放
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
这篇关于UIImageView使用动画块从中心缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!