hi i am working with Mapkit and i have to show annotation in the map but am not able to display the annotation hers my code plz tell me where i am going wrong
@interface MyMapView : UIViewController <MKAnnotation,MKMapViewDelegate>{
MKMapView *Obj_Map_View;
MKPlacemark *pmark;
MKReverseGeocoder *geocoder1;
}
@end
#import "MyMapView.h"
@implementation MyMapView
(id)init { if (self = [super init]) {
} return self; }
(void)loadView {
[super loadView];
Obj_Map_View = [[MKMapView alloc]initWithFrame:self.view.bounds]; Obj_Map_View.showsUserLocation =YES; Obj_Map_View.mapType=MKMapTypeStandard; [self.view addSubview:Obj_Map_View]; Obj_Map_View.delegate = self;CLLocationCoordinate2D cord = {latitude: 19.120000, longitude: 73.020000}; MKCoordinateSpan span = {latitudeDelta:0.3, longitudeDelta:0.3}; MKCoordinateRegion reg= {cord,span}; [Obj_Map_View setRegion:reg animated:YES]; //[Obj_Map_View release]; }
(NSString *)subtitle{ return @"Sub Title"; }
(NSString *)title{ return @"Title"; }
(MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id ) annotation { MKPinAnnotationView *annov = [[MKPinAnnotationView alloc]initWithAnnotation:annotation reuseIdentifier:@"Current location"]; annov.animatesDrop = TRUE; [annotation title]==@"Current location"; annov.canShowCallout = YES; [annov setPinColor:MKPinAnnotationColorGreen]; return annov; }
The above code works fine and displays a map but not with annotation, so plz tell me where am going wrong.... Thank You