カスタム アノテーション クラスをマップビューに追加するときに、そのクラスにアクセスできません。カスタム クラスは正常に動作していますが、それをマップに追加すると、このデリゲートを介してカスタム アノテーションにアクセスする方法がわかりません。
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
私はオンラインで探してみましたが、何も見つかりませんでした。どんな助けでも素晴らしいでしょう。
次のように呼び出されます。
CLLocationCoordinate2D coords = CLLocationCoordinate2DMake(shops.latitude, shops.longitude);
AnnotationForId *shop = [[AnnotationForId alloc] initWithCoordinate:coords];
//[[CLLocationCoordinate2DMake(shops.latitude, shops.longtitude)]];
shop.title = shops.name;
shop.subtitle = @"Coffee Shop";
shop.shopId = shops.id;
[map addAnnotation:shop];