How to resize callout bubble after resetting title/subtitle

早过忘川 提交于 2019-12-05 21:18:02

Still having some problems, but getting closer maybe. I tried this, but still no luck. I am partially drawing on the code from http://digdog.tumblr.com/post/252784277/mapkit-annotation-drag-and-drop-with-callout-info

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view
{
    NSLog(@"Annotation was TAPPED!");

    if ([view.annotation isKindOfClass:[PushPin class]]) {
        ((PushPin *)view.annotation).title = @"test";
    }

    [self willChangeValueForKey:@"subtitle"]; // Workaround for SDK 3.0, otherwise callout info won't update.
    [self didChangeValueForKey:@"subtitle"]; // Workaround for SDK 3.0, otherwise callout info won't update.

    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"MKAnnotationCalloutInfoDidChangeNotification" object:self]];
}

Good news is that, I figured out my casting problem, for others who may be curious.

((PushPin *)view.annotation).title = @"test";
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!