IOS MapView标注调整大小

alw*_*eta 5 objective-c mapkit ios callout

目前我正在使用ios mkmapview来显示在地图上添加pin的poi,当用户点击pin时,默认的callout会出现并显示poi的标题,但是有些标题很长而且标注不够宽,无法完全显示标题.我想要的只是让标注更宽,我该怎么做?我搜索了几个小时的答案,但都是关于为callout实现自定义类,有没有办法只是重新调整大小而不进一步实现?我想念一些明显的东西吗?

Mar*_*ina 0

我几乎在做类似的事情。因为我不喜欢地图上的正常标注,所以我创建了自定义标注。在标头中实现 MKMapViewDelegate 并(void)mapView:(MKMapView *)aMapView didSelectAnnotationView:(MKAnnotationView *)view在实现文件中声明该方法。在此方法中,我创建一个显示注释内容的新视图。添加一个 UIButton 以关闭此自定义视图。

//deselect the selected annotation
- (void)deselectAnnotation {
    selectedAnnotation = mapView.selectedAnnotations;
    for (int i = 0;i < selectedAnnotation.count; i++) {
        [mapView deselectAnnotation:[selectedAnnotation objectAtIndex:i] animated:NO];
    }
}
Run Code Online (Sandbox Code Playgroud)