(iPhone)如何使用OS 4.0 MapKit实现可拖动管脚?

(iPhone)如何使用OS 4.0 MapKit实现可拖动管脚?,iphone,mapkit,draggable,mkmapview,drag,Iphone,Mapkit,Draggable,Mkmapview,Drag,任何人都可以提供使用MapKit框架在OS 4.0中实现可拖动管脚的示例代码/说明吗?当然可以,伙计(是的,我在自言自语) 在自定义批注中添加: @property (nonatomic, readwrite, assign) CLLocationCoordinate2D coordinate; 如前所述,这满足了实现setCoordinate的要求inhttp://developer.apple.com/iphone/library/documentation/MapKit/Referen

任何人都可以提供使用MapKit框架在OS 4.0中实现可拖动管脚的示例代码/说明吗?

当然可以,伙计(是的,我在自言自语)

在自定义批注中添加:

@property (nonatomic, readwrite, assign) CLLocationCoordinate2D coordinate; 
如前所述,这满足了实现setCoordinate的要求inhttp://developer.apple.com/iphone/library/documentation/MapKit/Reference/MKAnnotationView_Class/Reference/Reference.html#//apple_ref/occ/instp/MKAnnotationView/draggable

在MapView代理中添加:

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annotationView didChangeDragState:(MKAnnotationViewDragState)newState fromOldState:(MKAnnotationViewDragState)oldState 
{
//..Whatever you want to happen when the dragging starts or stops
}
在AnnotationView中,将draggable设置为true,例如:

customAnnotationView.draggable      = YES;

我想这就是我为了让它工作所做的一切。如果有问题,请告诉我。

请查看黄清朗和作者的随行人员。

我正在使用《更多iPhone开发》一书中的自定义注释类“MapLocation”-这是一个普通的自定义注释类。我添加了,分配给现有属性,使其与上面一样,但从未调用拖动回调。在viewForAnnotation中,我将注释强制转换为MapLocation,并获取其视图并设置draggable=YES。我这样做只是为了测试,我可能会使用OS3支持。但是你知道可能会缺少什么吗?特里斯坦,你愿意分享你用来让它工作的代码吗?我正在做我能想到的一切,但由于某些原因,我无法移动pin,我已经尝试了我能找到的所有教程(包括下面的评论)。非常感谢。