2015-01-21 4 views

답변

-1

가장 쉬운 방법은 nilMKMapView의 대리자로, 대리자 메서드가 호출되지 않도록하는 것입니다. 당신이 시도 할 수

self.mapView.delegate = nil; 
0

것은지도의 현재 상태를 확인, 콜백에서 다음 화면 재생 빈도에 연결되는 CADisplayLink을 만드는 것입니다. 여기에서 setRegion:animated:을 현재 위치로 호출하여 이전 애니메이션을 중지 할 수 있습니다.

2

다른 애니메이션을 만들지 만 기존 애니메이션과 다른 영역을 만들면 기존 애니메이션이 무효화됩니다. 참고 : 새 애니메이션을 만들려고해도 visibleMapRect와 동일한 경우 iOS에서 무시합니다. 참조

func stopZoom() { 
    //the trick: creating a region very similar to the existing one 
    var mapRegion:MKCoordinateRegion = MKCoordinateRegionForMapRect(self.mapView.visibleMapRect) 
    mapRegion.span.latitudeDelta = mapRegion.span.latitudeDelta + 0.000001 

    UIView.animateWithDuration(0.1, delay: 0.0, options: [], animations: { 
    let mapRegion:MKCoordinateRegion = mapRegion 
    self.mapView.setRegion(mapRegion, animated: true) //this will invalidate the other animations 
    }) { (completed: Bool) -> Void in 
} 

}

startZoom 방법 :

func startZoom() { 
    UIView.animateWithDuration(10, delay: 0.0, options: [UIViewAnimationOptions.CurveLinear, UIViewAnimationOptions.AllowUserInteraction, UIViewAnimationOptions.BeginFromCurrentState], animations: { 
    let mapRegion:MKCoordinateRegion = MKCoordinateRegionMakeWithDistance(self.coordinate, 500, 500) 
    self.mapView.setRegion(mapRegion, animated: true) 
    }) { (completed: Bool) -> Void in 
} 

}

이를 알아 내기 위해 꽤 많은 시간 소비가, 내가 당신에게 도움이 될 것입니다 바랍니다.

관련 문제