MKPointAnnotation add extra property

2019-07-18 23:08发布

Is it possible to add an extra property to MKPointAnnotation? At the moment there is coordinate, title, and subtitle.

Is it possible to add a url property which can be accessed within -(MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{ }, just like I can access[annotation title];?

1条回答
等我变得足够好
2楼-- · 2019-07-18 23:40

Just make an MKPointAnnotation subclass.

Delete all the methods out of the .m file, and add this to your .h file:

@property (nonatomic, strong) NSURL *url;
查看更多
登录 后发表回答