'How to remove info button on iOS MapBox?
Solution 1:[1]
Set
mapView.logoView.isHidden = true
mapView.attributionButton.isHidden = true
and in info.plist
MGLMapboxMetricsEnabledSettingShownInApp to YES
Solution 2:[2]
You should keep that button like a sort of copyright:
All uses of Mapbox’s custom maps and data must attribute both Mapbox and the appropriate data providers. Mapbox’s custom design is copyrighted and our data sources require attribution.
Automatic attribution
If you use a different Mapbox SDK library, like Mapbox.js or Mapbox Mobile, the necessary attribution will be automatically included in the bottom right corner of the map.
Solution 3:[3]
If you must remove the button for your app, then you would have to
- Modify the source and remove the
_attributionButton - recompile the iOS SDK and keep up with code changes from mapbox-gl-native (thereby losing any advantages of CocoaPods for Mapbox, if you use it).
- Then add in a custom User Interface for copyright and attribution. (See link as @SaintThread mentions).
You still need to adhere to the Mapbox terms of service, so the above steps will be extra work with minimal gain. Most maps users from any service are most likely used to an info button.
Solution 4:[4]
Add MGLMapboxMetricsEnabledSettingShownInApp into info.plist with YES value
Add the following code after mapView initialization:
[mapView.logoView setHidden:YES]; [mapView.attributionButton setHidden:YES];
Solution 5:[5]
In MapBox iOS v10
Where map is an instance of MapView.
private func hideOrnaments() {
map.ornaments.options.logo.margins = .init(x: -10000, y: 0)
map.ornaments.options.attributionButton.margins = .init(x: -10000, y: 0)
map.ornaments.options.scaleBar.visibility = .hidden
map.ornaments.options.compass.visibility = .hidden
}
Keep in mind that you're supposed to show the logo and info button as requested by MapBox' terms and conditions.
It's obvious MapBox doesn't want you to hide their logo easily. But I've found a workaround by setting its margins to be off-screen. ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Timeless |
| Solution 2 | Marco Santarossa |
| Solution 3 | RobLabs |
| Solution 4 | Alessandro Pirovano |
| Solution 5 | Pomme2Poule |

