2つのビューの原点をアニメーション化する単純なUIViewアニメーションブロックがあります。マップビュービューの特別な位置にボタンがあります。そのため、マップの中心をアニメーション化してピンをマップと一緒に移動したい場合、マップはボタンよりも速く移動します。ボタンのアニメーションを速くしたり、マップのアニメーションを遅くしたりする方法はありますか?現時点では、マップが移動し、ボタンが終了位置にジャンプしているように見えます。
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];
}];
何か案は?