是否有可能在MKAnnotation引腳改變我自己設計的PNG?更改PIN設計
Q
更改PIN設計
4
A
回答
4
覆蓋這一點,並MKMapViewDelegate的委託來實現覆蓋的方法。
- (MKAnnotationView *)mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation;
創建註釋,
MKAnnotationView *annotationView = (MKAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:AnnotationViewID];// get a dequeued view for the annotation like a tableview
if (annotationView == nil)
{
annotationView = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID] autorelease];
}
annotationView.annotation = annotation;
annotationView.canShowCallout = YES; // show the grey popup with location etc
UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
///[rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside];
annotationView.rightCalloutAccessoryView = rightButton;
annoationView.image = [UIImage imageNamed:@"random.png"];
自定義圖像進行
2
是的,在viewForAnnotation委託回調可以提供力所能及的觀看你喜歡的。
1
對於自定義標註圖像,設置圖像屬性,因爲這樣。
UIImage *annImage = [UIImage imageNamed:@"AnnotationIcon.png"];
annView.image = annImage;
請注意,MKPinAnnotationView animateDrop屬性不會對自定義圖像工作。有一種方法可以複製該動畫。見How do I animate MKAnnotationView drop?
相關問題
- 1. 更改google地圖中的pin標籤?
- 2. iOS MapKit更改mapview maptype導致註釋圖像更改爲pin?
- 3. 更改EditText的設計
- 4. 在設計時更改AppResources
- 5. 更改設計的sign_in url
- 6. 蓮藕運行時設計更改
- 7. 更改Android微調器佈局/設計
- 8. 更改默認路由設計的Rails
- 9. 更改材質設計AppCompat ActionBar顏色
- 10. 如何更改重定向的設計
- 11. html + css表格設計更改
- 12. 數據庫設計更改JPA
- 13. Datatables表格工具設計更改?
- 14. 設計 - 更改路線的名稱
- 15. 更改設計時的顏色菜單
- 16. 在設計中更改用戶密碼
- 17. 更改設計默認根目錄
- 18. 如何更改UIBarButtonItem按鈕設計?
- 19. Angular $ http更改網址在Rails設計
- 20. 離子更改默認下拉設計
- 21. stm32動態計時器設置更改
- 22. 更改設計結帳的Magento
- 23. 將更改的PIN寫入卡的APDU命令
- 24. 如何將紅色Pin更改爲自定義圖像? iOS
- 25. MKMapView如何更改用戶最近位置的PIN圖像?
- 26. 如何使用Android中的sharedpreferences更改PIN碼?
- 27. Pin It按鈕不顯示計數
- 28. 改變Pin的顏色iOS MapKit
- 29. 問題設計審計表以跟蹤更改
- 30. Java ME RS232通信。電源PIN設置