问题
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:
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;
来源:https://stackoverflow.com/questions/16737813/mkpointannotation-add-extra-property