1

I am trying to do custom map calloutview:

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    if ([view.annotation isKindOfClass:[MKUserLocation class]])
    {
        UIView * callout = [[NSBundle mainBundle] loadNibNamed:@"MyCallout" owner:nil options:nil][0];
        for (int i = 0; i < view.subviews.count; i++)
            [view.subviews[i] setHidden:YES];
        [view addSubview:callout];
        view.userInteractionEnabled = YES;
        return;
    }

    // ...
}

So my callout is inaccessible, buttons can not be pressed etc...

k06a
  • 17,755
  • 10
  • 70
  • 110
  • 1
    I am not sure the approach this code takes will work well but the issue may be that the annotation view's frame is smaller than the callout view you are adding to it. Try setting view.frame equal to callout.frame. –  Jul 03 '13 at 02:40
  • @AnnaKarenina you were totally right! Please, post you comment as answer with this link: http://stackoverflow.com/questions/5844356/uiview-why-does-a-subviews-outside-its-parents-extent-not-receive-touches – k06a Jul 03 '13 at 08:31

0 Answers0