current location focusing

2920
2
06-14-2013 08:54 PM
aamirmansuri
New Contributor
hi,

I want to focus my current location on a button event because I am using place searching over map and then I want to move on my current location.
so how to do it .
please help me.

thank you.
0 Kudos
2 Replies
NimeshJarecha
Esri Regular Contributor
You can do it using following code.

self.mapView.locationDisplay.autoPanMode = AGSLocationDisplayAutoPanModeDefault;
[self.mapView.locationDisplay startDataSource];

Regards,
Nimesh
0 Kudos
ThomasSvitil
New Contributor
Hello,

I use this code, but it only zooms/focuses the first time when executed.


self.mapView.locationDisplay.autoPanMode = AGSLocationDisplayAutoPanModeDefault;
[self.mapView.locationDisplay startDataSource];


Any other time, the LocationDisplay is shown on the map but no zoom happens (It only centers to the current location).
I hacked my way around zooming manually with
[self.mapView zoomToScale:10000 withCenterPoint:self.mapView.locationDisplay.mapLocation animated:TRUE];
every time i call the code.

Is there a better way to achieve a behaviour where the zoom happens every time the code is executed?

Have a nice day!
0 Kudos