Search code examples
mapbox-ios

changing location of mapbox wordmark and text atribution


Rotating the map according to the device orientation, makes position of watermark a bit strange. I understand that that watermark and text attribution are placed relatively to the margin
screenshot of landscape view of map on iphone X I would prefer to locate these objects closer to the corners screenshot of portrait app view with mapbox wordmark How can I get it?


Solution

  • If you would like to set the logoView and the attributionButton margins to different values when the device is rotated, you need to access the MGLOrnamentPosition enumeration using the following code:

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

    where CGPoint would reference the appropriate x and y values for your device.