0
我想創建不帶標註的自定義MKAnnotationView
(帶圖像),但在觸摸後可擴展。以下是我心目中:自定義MKAnnotationView無需標註即可展開
1)首先MKAnnotation
看起來是這樣的:
2)然後在其上點擊此應擴大,看起來像這樣經過:
我已經開始定製MKAnnotationView
並且有一個類:
@interface CustomPinAnnotation : NSObject <MKAnnotation>
類有方法:
-(MKAnnotationView*)annotationView {
MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:self reuseIdentifier:@"AnnotationIdentifier"];
annotationView.enabled = YES;
annotationView.image = [[UIImage imageNamed:@"star"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
return annotationView;
}
什麼我嘗試做的是設置一個customView作爲一個子視圖到MKAnnotationView
,但是當我不設置圖像也不會響應(此在我考慮這個問題之後,我覺得這很合乎邏輯),但是感覺我在這裏做的事情非常討厭,應該是一種以某種方式覆蓋MKAnnotationView
的方法。
哦,容易和完美!我知道我正在過度引導它:)謝謝! – Kuba