Създавам бутони с балон с пояснения със следния код:
-(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{
if ([annotation isKindOfClass:[MKUserLocation class]])
return nil;
MKPinAnnotationView *view = [mapView dequeueReusableAnnotationViewWithIdentifier:@"ParkPlaceMark"];
if(!view)
{
view=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"ParkPlaceMark"];
}
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[rightButton addTarget:self action:@selector(ShowDetails:)forControlEvents:UIControlEventTouchUpInside];
view.rightCalloutAccessoryView = rightButton;
[view setCanShowCallout:YES];
return [view autorelease];
}
Как мога да получа това, което анотация е щракване, така че да отида в подробности екран с идентификатор и донесе база данни запис въз основа на този идентификатор, за да покаже информация.
Моля помогнете.
Отговори:
1 за отговор № 1Трябва да приложите този метод на делегиране:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
0 за отговор № 2
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
appDelegate.mallIDStr=[dict valueForKey:@"Mall_Id"];
self.tabBarController.selectedIndex = 2;
}
в по-горе код аз спаси mall id, когато кликнете върху всеки пин, които показват местоположението на мола