Search code examples
iosswiftesri

Move to current location when location button clicked in Esri map


Need to move to current location in Esri Map when user clicked on current location button. I try to find out but not able to find anything about it for Esri map

I do following code but it is not working

//MARK:
    //MARK: current location button clicked
    func btnCurLoc_Clicked(_ sender:UIButton)
    {
        arcGISMapView.locationDisplay.startDataSource()
    }

Solution

  • If you want the map to automatically zoom to the current location you need to also set the autopan modeon the locationDisplay to one of the options here The most basic centering one is AGSLocationDisplayAutoPanModeRecenter.