I´m creating a view with a Map and an annotation using the following class:
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface ContactDetailAnnotation : NSObject <MKAnnotation>
- (id) initWithLatitude:(CLLocationDegrees) lat longitude:(CLLocationDegrees) lng;
- (id) initWithCoordinate:(CLLocationCoordinate2D) coordinateArg;
@property (unsafe_unretained) CLLocationDegrees latitude;
@property (unsafe_unretained) CLLocationDegrees longitude;
@property (unsafe_unretained, nonatomic) CLLocationCoordinate2D coordinate;
@end
The problem is that the method:
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
used to draw my Point isn´t being trigered. If i use
self.myMap.showsUserLocation = TRUE;
The method is trigered, so the problem must be in the class i created.
My .m
#import "ContactDetailAnnotation.h"
@implementation ContactDetailAnnotation
@synthesize latitude = _latitude, longitude = _longitude, coordinate = _coordinate;
- (id) initWithCoordinate:(CLLocationCoordinate2D) coordinateArg
{
self.coordinate = coordinateArg;
return self;
}
- (id) initWithLatitude:(CLLocationDegrees)lat longitude:(CLLocationDegrees)lng
{
self.latitude = lat;
self.longitude = lng;
return self;
}
- (CLLocationCoordinate2D) coordinate
{
CLLocationCoordinate2D coord = {self.latitude,
self.longitude};
return coord;
}
@end