- 私:MKAnnotation doesn'tトリガーピンポイントドロー法
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
:
#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
問題は方法であります私のポイントを描画するために使用されていないtrigeredされています。私は
self.myMap.showsUserLocation = TRUE;
を使用する場合は 方法はtrigeredされているので、問題は、私が作成したクラスでなければなりません。
マイ.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
' - (CLLocationCoordinate2D)coordinate'メソッドをオーバーライドする必要はありません。 –
そのメソッドを削除するとクラッシュします。 – bruno