Center map on current position?

Discussion in 'iOS Programming' started by ctdonath, Mar 8, 2013.

  1. ctdonath macrumors 65816

    ctdonath

    Joined:
    Mar 11, 2009
    #1
    Is there some trivial way to let the user center the map on current GPS position?

    The app doesn't really care where (save perhaps for a pin drop there), no need to stay centered if moving, just scroll the map to current position when button is tapped.
     
  2. Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #2
    Get the current location and change the map region to center on that location. Takes about 3 lines of code.
     
  3. waterskier2007 macrumors 68000

    waterskier2007

    Joined:
    Jun 19, 2007
    Location:
    White Lake, MI
    #3
    Code:
    [MKMapView setRegion:(MKCoordinateRegion) [I]region[/I] animated:(BOOL) [I]animated[/I]]
    
     

Share This Page