【问题标题】:IOS MapView callout resizeIOS MapView标注调整大小
【发布时间】:2012-06-13 22:52:37
【问题描述】:
目前我正在使用 ios mkmapview 显示一些在地图上添加了 pin 的 pois,当用户单击 pin 时,默认标注会出现并显示 poi 的标题,但有些标题相当长且标注不够宽,无法完全显示标题。
我想要的只是让标注更宽,我该怎么做?
我搜索了几个小时的答案,但都是关于为标注实现自定义类,有没有办法在不进一步实现的情况下重新调整它的大小?
我错过了什么明显的东西吗?
【问题讨论】:
标签:
objective-c
ios
mapkit
callout
【解决方案1】:
我正在做几乎类似的事情。因为我不喜欢地图上的正常标注,所以我创建了自定义标注。在您的标头中实现 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];
}
}