我有一个简单的 UIView 动画 block ,它为 2 个 View 的原点设置动画。我在 map View View 的特殊位置上有一个按钮。所以当我想为 map 的中心设置动画并随 map 移动图钉时, map 的移动速度比按钮快。有没有办法加快按钮的动画速度或减慢 map 的动画速度?此刻看起来 map 移动了,按钮跳到了他的结束位置。
CGPoint newCenter = mapView.center;
newCenter.x -= 1;
newCenter.y -= (button.frame.size.height/2)
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationCurveEaseIn animations:^{
CGPoint screenPoint = fakePin.frame.origin;
screenPoint.x -= 5;
screenPoint.y += button.frame.size.height-4;
mapView.mapCoord = [mapView.map convertPoint:screenPoint toCoordinateFromView:self.view];
self.mapView.map.centerCoordinate = mapView.mapCoord;
[button setCenter:newCenter];
}];
有什么想法吗?
最佳答案
为什么不将按钮显示为注释?然后它会沿着 map 移动。
不过,请尝试为按钮而不是中心的属性框架设置动画。您需要自己进行计算,但我认为这可能是问题所在。
关于ios - 在 Animation 中减慢 UIView 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14600736/