iphone zoom to user location on mapkit

Posted by satyam on Stack Overflow See other posts from Stack Overflow or by satyam
Published on 2010-06-16T17:14:52Z Indexed on 2010/06/16 18:02 UTC
Read the original article Hit count: 675

Filed under:
|
|

I'm using map kit and showing user's location using "showsUserLocation" I"m using following code to zoom to user's location, but not zooming. Its zooming to some location in Africa, though the user location on map is showing correct.

MKCoordinateRegion newRegion; 
MKUserLocation* usrLocation = mapView.userLocation; 
newRegion.center.latitude = usrLocation.location.coordinate.latitude; 
newRegion.center.longitude = usrLocation.location.coordinate.longitude;
newRegion.span.latitudeDelta = 20.0;
newRegion.span.longitudeDelta = 28.0; 
[self.mapView setRegion:newRegion animated:YES];

Why is user's location correctly showing and not zooming properly. Can some one correct me please?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about mapkit