0
希望有人可以提供幫助,我正試圖在mapView上實施拖放一個Pin。但是我希望該引腳能夠被拖動和放下,並且此註釋與用戶位置的註釋分開。雖然下面的代碼的作品,它的用戶觸摸創建重複的引腳,引腳不能上拖動:如何在地圖上拖放和拖動一個別針Objective-C
- (void)dropPinFromPress:(UIGestureRecognizer *)recognizer {
// Add Pin from User's Touch
if (recognizer.state != UIGestureRecognizerStateBegan) {
return;
}
// convert touched position to map coordinate
CGPoint userTouch = [recognizer locationInView:self.mapView];
CLLocationCoordinate2D mapPoint = [self.mapView convertPoint:userTouch toCoordinateFromView:self.mapView];
// Add Pin from user's touch
Annotation *pin = [[Annotation alloc]initWithLocation:mapPoint];
[self.mapView addAnnotation:pin];
}
你有你的解決方案? –