Reputation: 1188
I'm building a map application with the Mapbox SDK. Here is how I present an annotation on the map and auto-show the title popup:
[myAnnotation setCoordinate:touchMapCoordinate];
myAnnotation.title = @"This Is A Title";
[self.mapView addAnnotation:myAnnotation];
[self.mapView selectAnnotation:myAnnotation animated:YES];
Currently, the title pops up with a standard white background. However, I'd like the title to have a black background, as I use the light map and want the pop up to stand out a bit more. How could I do this?
Upvotes: 1
Views: 1060
Reputation: 2421
As of Mapbox iOS SDK v3.2.0, the default callout view isn’t exposed and you’re not able to change its appearance beyond adding accessory views and title text.
Instead, you should provide a custom callout view that conforms to the MGLCalloutView protocol, then display it with your map using the MGLMapViewDelegate method -mapView:calloutForAnnotation:.
See this example for a working implementation in both Objective-C and Swift. The default callout view uses SMCalloutView and you could relatively easily adapt this example to also use it.
Upvotes: 1