iOS MapKit userLocation 在第一次调用时返回零,但是
我有一个无法解释的奇怪问题,想知道是否有人遇到过同样的问题。
我有一个 MKMapView,它显示用户的当前位置,并被写入以在加载时将区域置于该位置的中心。当我加载视图时,地图默认为纬度零和经度零(在非洲的某个地方)。当我将视图保留在堆栈上的上一个屏幕,然后返回到它时,一切正常,并且我得到了一个以加利福尼亚州库比蒂诺为中心的地图视图,如预期的那样。
谁能解释一下吗?
干杯! :D
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当位置管理器无法跟踪位置时,其工作设备非常完美,然后其显示默认位置,即纬度零和经度零,因此其显示在非洲。
检查设备,它会正常工作。
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 尝试在地图视图加载后获取坐标。
在获取值之前,用户位置始终为 (0,0)
所以viewdidload中不要添加setregion方法
将其添加到以下方法中:
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: