ios - map View 的 'shows user location'选项有什么作用?

标签 ios dictionary mkmapview cllocationmanager

我已在 Storyboard中选中 map View 的“显示用户位置”选项。 我正在使用模拟器,无法访问真实设备。当我运行代码时,我可以看到 map 中的蓝色图标默认为加利福尼亚州,如您所料。

我想知道这个蓝色图标是否会在真实设备上更新?当用户移动时它会移动吗?

或者是否必须添加额外的代码才能使其工作?

最佳答案

Storyboard选项对应于 MKMapViewshowsUserLocation 属性。来自documentation (强调)

This property does not indicate whether the user’s position is actually visible on the map, only whether the map view should try to display it. Setting this property to YES causes the map view to use the Core Location framework to find the current location and try to display it on the map. As long as this property is YES, the map view continues to track the user’s location and update it periodically. The default value of this property is NO.

当然,这是假设位置服务已开启且用户已授予应用访问这些服务的权限。

关于ios - map View 的 'shows user location'选项有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20034196/

相关文章:

ios - Travis CI 的完整 Xcode 版本和设备名称/操作系统列表?

swift - 为什么 MKPolyline 没有出现在我的应用程序中?

ios - 在 MKMapView 中将 KML 文件映射到折线

java - 从 JSON 转换为 Map 的递归函数

c# - 从没有索引的 Dictionary<,> 中获取下一个 KeyValuePair<,>

linux - 预设字典是否仅对前 32 K 字节的数据有用?

iOS 设置 MKMapView 相机航向围绕 anchor 旋转

ios - mapkit xcode 8 中的 onclick 事件弹出窗口

ios - 动画 self.view.frame?

ios - UIDatePicker返回当前日期,即使我选择其他日期也是如此