質問

Hello i am new to ios and showing an annoatation on map view using lat and long coming from server. I have one view controller in which i am adding map and showing position of lat and long. But my problem is whenever i am adding annotation map is not focusing on annotattion insted of it everytime i want pinch map view then map is going to at annoatation i dont know why this is happening?

zoomLocation.latitude = latmpa.doubleValue;
zoomLocation.longitude = logmpa.doubleValue;
annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = zoomLocation;
annotationPoint.title = @"masjid....";
[mapView selectAnnotation:annotationPoint animated:YES];

[mapView addAnnotation:annotationPoint];

here is my code adding in viewwillappera  
役に立ちましたか?

解決

You need to center the map by use the following code.

mapView.centerCoordinate = annotationPoint.coordinate;

他のヒント

Milan's solution does what you need without animation. If you want to do this with animation, you should use:

    [mapView setCenterCoordinate:location animated:YES];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top