I create MapPin.h and MapPin.m and define pin properties as following:
@interface** MapPin : NSObject<MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString title;
NSString subtitle;
}
@property ( nonatomic , assign ) CLLocationCoordinate2D coordinate;
@property** ( copy , nonatomic ) NSString title;
@property* ( copy , nonatomic ) NSString *subtitle;
–
and in ViewController.m I have code:
MKCoordinateRegion pin = {{0.0, 0.0}, {0.0, 0.0}};
pin.center.latitude = 37.7749;
pin.center.longitude = -122.4194;
pin.span.latitudeDelta = 0.01f;
pin.span.longitudeDelta = 0.01f;
[self.mapView setRegion:pin animated:YES];
MapPin *business = [[MapPin alloc] init];
business.title = @"Business inc";
business.coordinate = pin.center;
[self.mapView addAnnotation:business];
However, in my MapView the drop pin in this coordinate never shown. I’ve tried bunch of ways but just couldn’t get it. Any idea? thanks!