ios - How to zoom into user current location? -


i wanna zoom user current location when app starts in mapkit. code (in viewdidload function):

locate=[[cllocationmanager alloc]init]; locate.delegate=self; locate.desiredaccuracy=kcllocationaccuracybestfornavigation; locate.distancefilter=kcldistancefilternone; [locate startupdatinglocation]; [super viewdidload];  //region mkcoordinateregion myregion;  //center cllocationcoordinate2d center; center.latitude=locate.location.coordinate.latitude; center.longitude=locate.location.coordinate.longitude;  //span mkcoordinatespan span; span.latitudedelta=0.3f; span.longitudedelta=0.3f; //set region myregion.center=center; myregion.span=span; [_mymap setregion:myregion animated:yes]; 

also implemented didupdatelocation function same code previous. problem when user location changing (when user moving) screen makes zoom @ him can't move screen, if try move return user location immediately, can't see whole map.

for zooming map have change region values means center , span.once see 1 mapview zoom

in case have used 1 moving map when click on particular button.

mkcoordinatespan span = mkcoordinatespanmake(30.5982f,0.0001f);         cllocationcoordinate2d coordinate = {36, 90};         mkcoordinateregion region = {coordinate, span};         mkcoordinateregion regionthatfits = [self.mapview regionthatfits:region];         [self.mapview setregion:regionthatfits animated:yes]; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -