Reputation: 2365
I can successfully hide the Mapbox logoView
in an MGLMapView
, but when I try to do the same for the NavigationMapView
of a NavigationViewController
, it doesn't work. Here's what I'm trying:
@IBAction func startNavigation(_ sender: Any) {
guard let response = response, let route = response.routes?.first, case let .route(routeOptions) = response.options else { return }
let styles = [DayStyle()]
let options = NavigationOptions(styles: styles, navigationService: navigationService(route: route, options: routeOptions))
let navigationViewController = NavigationViewController(for: route, routeOptions: routeOptions, navigationOptions: options)
navigationViewController.delegate = self
presentAndRemoveMapview(navigationViewController, completion: beginCarPlayNavigation)
}
func navigationService(route: Route, options: RouteOptions) -> NavigationService {
let mode: SimulationMode = .onPoorGPS
return MapboxNavigationService(route: route, routeOptions: options, directions: Settings.directions, simulating: mode)
}
func presentAndRemoveMapview(_ navigationViewController: NavigationViewController, completion: CompletionHandler?) {
navigationViewController.modalPresentationStyle = .fullScreen
activeNavigationViewController = navigationViewController
present(navigationViewController, animated: true) {
activeNavigationViewController!.mapView!.logoView.isHidden = true
completion?()
}
}
func beginCarPlayNavigation() {
let delegate = UIApplication.shared.delegate as? AppDelegate
if #available(iOS 12.0, *),
let service = activeNavigationViewController?.navigationService,
let location = service.router.location {
delegate?.carPlayManager.beginNavigationWithCarPlay(using: location.coordinate, navigationService: service)
}
}
As you can see, the logo still shows up (bottom left).
What am I doing wrong?
Addendum: here's a bit of the main MGLMapView, showing that you can hide the logo there, as demonstrated in the example app in the SDK.
Upvotes: 0
Views: 346