Вопрос

I have a curious issue that I can't explain and was wondering if anybody has encountered the same problem.

I have a MKMapView that displays the user's current location, and is written to center the region over that location when loaded. When I load the view, the map defaults to lat zero and long zero (somewhere in Africa). When I leave the view to the previous screen on the stack, and then go back to it everything works properly and I get a mapview centered over Cupertino, California as expected.

Can anyone explain this?

Cheers! :D

Это было полезно?

Решение

mapView.showsUserLocation=YES;

Its Working Device Perfect when ever Location manager unable to Track The Location Then Its Shows Default Location Thats lat zero and long zero so Its Shows In Africa.

Check In Device It Will Work Fine.

Другие советы

UserLocation try to get the coordinate after map view loaded. before getting the value, user location always is (0,0) So do not add the setregion method in viewdidload add it into method fllowing:

func mapView(MKMapView, didUpdate: MKUserLocation)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top