我有带有多重注释的地图,我希望用户点击 pin 来调用另一个视图。
我正在使用故事板。
使用 .xib 这将是这样的。
...
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
...
[rightButton addTarget:self
action:@selector(showDetails:)
forControlEvents:UIControlEventTouchUpInside];
}
-(void)showDetails:(UIButton*)sender {
OfferDetailViewController *detail = [[OfferDetailViewController alloc] init];
detail.context = context;
Offers *offer = [arr objectAtIndex:indexPath.row];
//detail.offer = offer;
[self.navigationController pushViewController:detail animated:YES];
}
...