6
我有註釋蓄勢待發,但試圖找出如何使它可拖動我的代碼:iOS版 - 的MKMapView - 可拖動的註解
-(IBAction) updateLocation:(id)sender{
MKCoordinateRegion newRegion;
newRegion.center.latitude = mapView.userLocation.location.coordinate.latitude;
newRegion.center.longitude = mapView.userLocation.location.coordinate.longitude;
newRegion.span.latitudeDelta = 0.0004f;
newRegion.span.longitudeDelta = 0.0004f;
[mapView setRegion: newRegion animated: YES];
CLLocationCoordinate2D coordinate;
coordinate.latitude = mapView.userLocation.location.coordinate.latitude;
coordinate.longitude = mapView.userLocation.location.coordinate.longitude;
MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
[annotation setCoordinate: coordinate];
[annotation setTitle: @"Your Car is parked here"];
[annotation setSubtitle: @"Come here for pepsi"];
[mapView addAnnotation: annotation];
[mapView setZoomEnabled: YES];
[mapView setScrollEnabled: YES];
}
提前感謝!
非常感謝!我是iOS開發新手。 – 2012-08-13 03:53:08
我使用相同的,但不知道爲什麼它不工作你們有什麼想法.... – guru 2015-09-29 12:34:47