0
我開發瞭如餐館等本地搜索應用程序,通過使用這個程序http://www.totagogo.com/2011/02/08/google-local-search-ios-code/的,我的struct申請按鈕調出註釋通過導航到提取細節另一個detailViewController。請通過提供一些教程/示例代碼來幫助我解決這個問題。的MKMapView多個註釋叫喚按鈕細節視圖
我開發瞭如餐館等本地搜索應用程序,通過使用這個程序http://www.totagogo.com/2011/02/08/google-local-search-ios-code/的,我的struct申請按鈕調出註釋通過導航到提取細節另一個detailViewController。請通過提供一些教程/示例代碼來幫助我解決這個問題。的MKMapView多個註釋叫喚按鈕細節視圖
我得到了解決
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(GoogleLocalObject *) annotation
{
static NSString* AnnotationIdentifier = @"AnnotationIdentifier";
MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:AnnotationIdentifier] autorelease];
customPinView.pinColor = MKPinAnnotationColorRed;
customPinView.animatesDrop = YES;
customPinView.canShowCallout = YES;
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self
action:@selector(showDetails:)
forControlEvents:UIControlEventTouchUpInside];
customPinView.rightCalloutAccessoryView = rightButton;
UIImageView *memorialIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"googlemaps_pin.png"]];
customPinView.leftCalloutAccessoryView = memorialIcon;
[memorialIcon release];
return customPinView;
}
- (void)showDetails:(id)sender {
GoogleLocalObject *obj;
for (int i = 0; i < [objectsFromGoogle count]; i++) {
obj = [objectsFromGoogle objectAtIndex:i];
}
self.reverseGeocoder =
[[[MKReverseGeocoder alloc] initWithCoordinate:obj.coordinate] autorelease];
reverseGeocoder.delegate = self;
[reverseGeocoder start];
}