gustavomanolo
gustavomanolo

Reputation: 787

How can it get the user location in objective c with an iPhone and animation?

i have an iPhone project in xcode, i've put a mapview and with the next code i show the user's location:mapView.showsUserLocation=YES;. But i want that when the user opens the app the applications zooms with an animation automatically, i think that i need to put this code in the viewDidLoad method. Finally i need to store the latitude into a variable, i tried to to that with the next code: float latitud = mapView.userLocation.coordinate.latitude; but the latituded that this returned was not the correct one of my location, i think that i need to do this with the CLLocationManager but i don't know how to do that.

Please, help me.

Thanks a lot.

Upvotes: 0

Views: 699

Answers (1)

itZme
itZme

Reputation: 1439

If you are checking this with simulator you won't get your location coordinate. Your xcode give apple head-quarters as the user location

mapView.showsUserLocation=YES;

will work only in device.

Upvotes: 3

Related Questions