4
我有一個MapView上有兩個引腳(自定義引腳)。iOS mapView - 只有一個水龍頭的拖動銷
兩個引腳都設置爲可拖動,但我的問題是我可以拖動其中之一,我必須先選擇它,然後才能開始拖動它。這意味着屏幕上有兩個按鍵。
我知道this的答案,但他只有一個pin在他的地圖上,在我看來,一次只能選擇一個pin,所以設置[MyPin setSelected:YES];在這種情況下不會幫助我。
感謝您的幫助!
//Custom pin on mapview
-(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
MKAnnotationView *MyPin=[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"current"];
MyPin.draggable = YES;
//Get annotaion title to determine what image to use
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc]init];
annotationPoint = annotation;
if([annotationPoint.title isEqualToString:@"user"])
{
MyPin.image = [UIImage imageNamed:@"userLocation_pin"];
MyPin.centerOffset = CGPointMake(-13, -5); //Offset custom image to display at the exact pin point GPointMake([left/right], [up/down]);
}
else if ([annotationPoint.title isEqualToString:@"destination"])
{
MyPin.image = [UIImage imageNamed:@"destination_pin_up"];
MyPin.centerOffset = CGPointMake(-13, -5); //Offset custom image to display at the exact pin point GPointMake([left/right], [up/down]);
}
return MyPin;
}