[英]IOS MapView callout resize
目前我正在使用ios mkmapview來顯示在地圖上添加pin的poi,當用戶點擊pin時,默認的callout會出現並顯示poi的標題,但是有些標題很長而且標注不夠寬,無法完全顯示標題。 我想要的只是讓標注更寬,我該怎么做? 我搜索了幾個小時的答案,但都是關於為callout實現自定義類,有沒有辦法只是重新調整大小而不進一步實現? 我想念一些明顯的東西嗎?
我幾乎做了類似的事情。 因為我不喜歡地圖上的正常標注,所以我創建了一個自定義標注。 在頭文件中實現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];
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.