作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
对于我正在开发的 AR 体验,我想要一个“相机 View ”来显示基于用户位置的注释。如果用户在某个区域,则显示注释。
我可以用下面的方法做这样的事情
extension ViewController: AnnotationManagerDelegate {
func session(_ session: ARSession, cameraDidChangeTrackingState camera: ARCamera) {
print("camera did change tracking state: \(camera.trackingState)")
let annotationLocation = CLLocation()
let point = CGPoint(x: annotationLocation.coordinate.longitude, y: annotationLocation.coordinate.latitude)
let features = mapView.visibleFeatures(at: point);
if let score = features.first(where: { $0.attributes["score"] as! Int >= 5 }) {
// ...
但在我的 AR View 中,我想隐藏 map 而不是显示它。当我尝试设置 mapView.isHidden = true
- 查询总是失败。
这是有道理的,因为查询是针对可见特征的。如何隐藏 map ,但仍查询图 block 的特征?
最佳答案
进入 Mapbox Studio https://www.mapbox.com/studio/并创建一个新的 map 样式并删除所有图层。您可以将 Mapbox map 样式设置为单一纯色(陆地、水域、道路等),这正是您所需要的。如果您需要在 map 和空白 map 之间切换,只需在样式之间切换即可。
let basicMap = URL(string: "mapbox://styles/mapbox/outdoors-v9")
let blankMap = URL(string: "yourCustomURLFromMapboxStudio")
let mapView = MGLMapView(frame: view.bounds, styleURL: blankMap)
关于ios - 如何在没有可见 map 的情况下查询 Mapbox MGLMapView 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49806187/
我是一名优秀的程序员,十分优秀!