ios - Plot pin does not point exact place on MKMapView -


- (void)viewdidload {     uitapgesturerecognizer *taprecognizer = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(foundtap:)];     taprecognizer.numberoftapsrequired = 1;     taprecognizer.numberoftouchesrequired = 1;     [self.mymapview addgesturerecognizer:taprecognizer]; }  -(void)foundtap:(uitapgesturerecognizer *)recognizer {     cgpoint point = [recognizer locationinview:self.mymapview];       cllocationcoordinate2d tappoint = [self.mymapview convertpoint:point tocoordinatefromview:self.view];     mkpointannotation *point1 = [[mkpointannotation alloc] init];     point1.coordinate = tappoint;     [self.mymapview addannotation:point1]; } 

i used above code make pin point on mkmapview when choose place in mkmapview not point touches.it goes little far touches.what wrong code?.any appreciated.thanks in advance.

try changing passed-in object locationinview: method self.view:

-(void)foundtap:(uitapgesturerecognizer *)recognizer {     cgpoint point = [recognizer locationinview:self.view];        cllocationcoordinate2d tappoint = [self.mymapview convertpoint:point tocoordinatefromview:self.view];      mkpointannotation *point1 = [[mkpointannotation alloc] init];      point1.coordinate = tappoint;      [self.mymapview addannotation:point1]; } 

Comments