my MKAnnotationVIew is not showing the title
- by hydev
Hi,
I am new to iPhone programming and I can't understand why the MKAnnotationView is not showing the title's of my annotation's. Below is the code that is used to display it on the map.
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views
{
NSLog(@"Entered didAddAnnotationViews");
MKAnnotationView *annotationView = [views objectAtIndex:0];
id <MKAnnotation> mp = [annotationView annotation];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance([mp coordinate], 250, 250);
[mv setRegion:region animated:YES];
}
Here is where I am defining my annotations:
MapPoint *mp = [[MapPoint alloc]
initWithCoordinate:[newLocation coordinate]
title:[locationTitleField text]];
[mapView addAnnotation:mp];
[mp release];
mp is a class I have created to keep track of all the map points:
#import "MapPoint.h"
@implementation MapPoint
@synthesize coordinate, title;
- (id)initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString *)t
{
[super init];
coordinate = c;
[self setTitle:t];
return self;
}
- (void)dealloc
{
[title release];
[super dealloc];
}
@end
I am beginner so go easy, and all help greatly appreciated.
Mike