이 위임 방법에 대한 문제는 (그래서 당신은/THEN 또는 CASE/BREAK 경우 등은 "경량을 유지해야합니다"스크롤하는 동안,이 방법은지도 위치로 업데이트를보고 여러 번 호출 할 수 있습니다 "입니다 ").
이 메서드를 전혀 사용할 필요는 없지만 (쓸데없는) 일종의 기능 (예 : 쓸데없는 핀 제거 등)을 사용하려면 가볍게 유지하는 예제 코드를 사용해야합니다. :
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated{
if(!animated){
//Instantaneous change, which means you probably did something code-wise, so you should have handled anything there, but you can do it here as well.
} else {
//User is most likely scrolling, so the best way to do things here is check if the new region is significantly (by whatever standard) away from the starting region
CLLocationDistance *distance = [mapView.centerCoordinate distanceFromLocation:originalCoordinate];
if(distance > 1000){
//The map region was shifted by 1000 meters
//Remove annotations outsides the view, or whatever
//Most likely, instead of checking for a distance change, you might want to check for a change relative to the view size
}
}
}
오 주해보기가 위치를 자동으로 수정하지 않습니다. – quantumpotato
보기는 그렇지만 물론 핀은 그렇지 않습니다. 나는 단순히 외부 핀을 제거하는 것을 의미했습니다. 위 코드는 지역이 바뀔 때 특정 작업을 수행해야하는 개발자를위한 것입니다. 사람들이 무엇을보고 있는지 기록하고 싶다면 좋습니다. –
좋은 소리. 감사! – quantumpotato