The thing is that I have a main class : MyAnnotation
, created to display annotations on my mapView.
@interface lieuAnnotation : MyAnnotation
@property(readonly, nonatomic) UIImage *uneImage; // I cannot access this property.
@end
I created a second class lieuAnnotation
inheriting from this one with a new property (an UIImage
).
@interface MyAnnotation : NSObject<MKAnnotation> {
// Some variables
}
// Some methods
@end
On the map, when the pin is selected, I have set a disclosure indicator who calls the delegate method :
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
[self detailPinVue:view]; // Personnal method
}
Note that the disclosure indicator is only displayed for lieuAnnotation
instances
So view.annotation
should be a lieuAnnotation
instance.
Then I want to access my property :
- (void)detailPinVue:(MKAnnotationView *)view
{
[aView addSubview:view.annotation.uneImage];
}
The things is I can't access the property uneImage
because Xcode tells me :
Property 'uneImage' not found on object of type 'id'
But in my mind, it should be possible !
So I also tried to access it with that way :
lieuAnnotation *anno = [[lieuAnnotation alloc] init];
anno = view.annotation;
[aView addSubview:anno.uneImage];
But it's not working…
Thanks for help and ideas.