I am trying to open a detail view controller when a user taps a push pin.
I have also defined a custom annotation and I want to pass some of its information into the detail view controller. It looks like this:
@interface SquatAnnotationClass : NSObject <MKAnnotation> {
NSString *name;
NSString *address;
NSString *gendered;
NSString *availability;
NSString *directions;
NSString *commments;
CLLocationCoordinate2D coordinate;
}
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *address;
@property (nonatomic, retain) NSString *gendered;
@property (nonatomic, retain) NSString *availability;
@property (nonatomic, retain) NSString *directions;
@property (nonatomic, retain) NSString *comments;
- (id)initWithLocation:(CLLocationCoordinate2D)coord;
-(id) initWithCoordinate:(CLLocationCoordinate2D) acoordinate;
// Other methods and properties.
@end
This is where I am trying to access them
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view{
Right now, when I try to reference them it doesn’t know anything about them other than title.
My question is, how do i get at the properties of my custom annotation? For example, directions so that I may pass it into the detail controller.
thanks!
You need to cast the annotation object to your class: