I'm working with MapQuest but I think that is not the problem.
I have map (with MapQuest) and custom pins on it. I can tap the pins and my custom callout (xib-file with labels and one button) pops up and everything is working fine. The only problem is that I can't press the button on the custom callout view (UIView).
Here is my code:
-(MQAnnotationView*)mapView:(MQMapView *)aMapView viewForAnnotation:(id<MQAnnotation>)annotation {
static NSString* identifier = @"Pins";
MQAnnotationView * annotationView = (MQAnnotationView *)[self->mapView dequeueReusableAnnotationViewWithIdentifier:identifier];
annotationView = [[MQAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
annotationView.image = [UIImage imageNamed:@"marker_schuhe"];
annotationView.enabled = YES;
annotationView.canShowCallout = NO;
return annotationView;
}
And in my didSelectAnnotationView method:
- (void)mapView:(MQMapView *)mapView didSelectAnnotationView:(MQAnnotationView *)view {
callOutView *calloutView = (callOutView *)[[[NSBundle mainBundle] loadNibNamed:@"callOutView" owner:self options:nil] objectAtIndex:0];
CGRect calloutViewFrame = calloutView.frame;
calloutViewFrame.origin = CGPointMake(-calloutViewFrame.size.width/2 + 15, -calloutViewFrame.size.height);
calloutView.frame = calloutViewFrame;
[calloutView.my_button addTarget:self action:@selector(button_pressed:) forControlEvents:UIControlEventTouchUpInside]; //here is something wrong, button_pressed is never called
[view addSubview:calloutView];
}