更改 mapbox 字标和文本属性的位置

changing location of mapbox wordmark and text atribution

根据设备方向旋转地图,水印的位置有点奇怪。我了解水印和文字属性相对于边距放置
screenshot of landscape view of map on iphone X 我更愿意将这些对象定位在更靠近角落的位置 screenshot of portrait app view with mapbox wordmark 我怎样才能得到它?

如果您想在设备旋转时将 logoView 和 attributionButton 边距设置为不同的值,您需要使用以下代码访问 MGLOrnamentPosition 枚举:

 if UIDevice.current.orientation.isLandscape {
     mapView.logoViewMargins = CGPoint()
     mapView.attributionButtonMargins = CGPoint()
 }

其中 CGPoint 会为您的设备引用适当的 x 和 y 值。