开发者

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

开发者 https://www.devze.com 2023-02-13 21:35 出处:网络
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;.

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.

Pl开发者_开发技巧ease, help me.

Thanks a lot.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号