I implemented a class that extends MKPinAnnotationView. I want to draw something below the pin, which I hope to achieve by taking over the drawRect:rect message. I want to do this by painting something myself first and then chaining to the superclass.
The problem is that this message doesn't event get sent. I already tried setting the frame size to something not empty or nil (the classic cause) without any effect. Could the implementation of the MKPinAnnotationView somehow cause the drawRect:rect message to not be sent to subclasses?
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface QueryAnnotationView : MKPinAnnotationView {
}
- (id)initWithAnnotation:(id <MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier;
@end
Implementation :
#import "QueryAnnotationView.h"
@implementation QueryAnnotationView
- (id)initWithAnnotation:(id <MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier;
{
self = [super initWithAnnotation:annotation reuseIdentifier:reuseIdentifier];
if (self)
{
self.frame = CGRectMake(0, 0, 65, 100);
}
return self;
}
- (void)drawRect:(CGRect)rect
{
NSLog(@"drawing my own stuff..");
[super drawRect:rect];
}
@end