我有一个 UIImageView
应该从 size (0,0) --> (93,75)
我有以下内容
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionTransitionNone
animations:^{
imgButton.layer.anchorPoint = CGPointMake(imgButton.bounds.size.width/2, imgButton.bounds.size.height/2);
CGRect btnFrame = imgButton.frame;
btnFrame.size.width = 105;
btnFrame.size.height = 85;
imgButton.frame = btnFrame;
}
completion:^(BOOL finished) {
[self animageButton2:imgButton];
}];
这是有效的,但我遇到的唯一问题是它不是从 UIImageView
的中心开始动画,而是从左上角开始。
有人知道吗?
最佳答案
我在 Borrden 的帮助下解决了这个问题。这就是我的解决方案。
首先创建一个imageview
UIImageView *imgLineup = [[UIImageView alloc]initWithFrame:CGRectMake(10, y, 93, 75)];
imgLineup.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.0, 0.0);
然后到下面。
[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseInOut
animations:^{
imgButton.layer.anchorPoint = CGPointMake(0.5, 0.5);
imgButton.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);
}
completion:^(BOOL finished) {
NSLog(@"done");
}];
关于iphone - 从 UIImageView 的中心动画 UIImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17362016/