Since MKAnnotation is a protocol, you'll have to define your own class that implements the protocol. For example,
@interface SPAnnotation : NSObject <MKAnnotation> {
CLLocationCoordinate2D coordinate;
}
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate;
If you have a latitude, longitude for the location you'd like to map:
SPAnnotation *annotation = [[Annotation alloc] initWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude)];
[myMap addAnnotation:annotation];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…