user1419810
user1419810

Reputation: 846

Xcode Mapkit zoom to current location

I have a map based iphone app that currently shows user locations and annotations pulled through json. I'm trying to create a button so that it zooms and centers on the user's current location. I have found the following code:

and understand that this can help however everywhere I paste this code I get errors. Does anyone know the steps to make this work/if this is the correct approach?

Thanks!!

Upvotes: 0

Views: 1540

Answers (1)

Carlos Vela
Carlos Vela

Reputation: 253

This may help you:

- (IBAction)showCurrentLocation:(id)sender {
self.mapview.showsUserLocation=YES;
self.mapview.delegate = self;
[self.mapview setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
}

Upvotes: 1

Related Questions