将自定义注释类添加到地图视图时,我无法访问它。我的自定义类正常工作,但是当我将它添加到地图时,我不确定如何通过此委托访问自定义注释:
- (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];