PDA

View Full Version : MKAnnotation Title




marcomn
Dec 8, 2009, 03:11 AM
Hello, please could anybody help me, i don't know more.
i have programmed an app, which loads a lot of points in maps and show it.
but now the problem is how I can write a title an subtitle for each annotation?
this is the code for my class which sets up the annotations:

#import "EarthquakeEventView.h"

@implementation EarthquakeEventView

- (id)initWithAnnotation:(id <MKAnnotation>)annotation
reuseIdentifier:(NSString *)reuseIdentifier {
if(self = [super initWithAnnotation:annotation
reuseIdentifier:reuseIdentifier]) {
self.backgroundColor = [UIColor clearColor];
}
return self;
}

- (NSString *)subtitle{
return @"Adresse";
}

- (NSString *)title{
return @"Name";
}

- (void)setAnnotation:(id <MKAnnotation>)annotation {
super.annotation = annotation;
if([annotation isMemberOfClass:[SeismicEvent class]]) {
event = (SeismicEvent *)annotation;
float magSquared = event.magnitude * event.magnitude;
self.frame = CGRectMake(0, 0, magSquared * .75, magSquared * .75);
} else {
self.frame = CGRectMake(0,0,0,0);
}

}
- (void)dealloc {
[event release];
[super dealloc];
}

@end


please help me, thanks



dejo
Dec 8, 2009, 09:05 AM
Does EarthquakeEventView implement the MKAnnotation protocol?