Reputation: 54888
Is there an easy way to enable night mode on a MKMapView
like the Apple Maps apps does when the sun is down ?
I didn't find such a thing the MapKit documentation.
Upvotes: 4
Views: 3747
Reputation: 203
Unfortunately it is a private api:
//add this above the interface of the class you want to try it on
@interface MKMapView ()
-(void) _setShowsNightMode:(BOOL)yesOrNo;
@end
//call this in your viewDidLoad or somewhere else appropriate
[self.mapView _setShowsNightMode:YES];
We should file a radar for apple to open this up to everyone. It could be a safety issue for people using maps in third party apps while driving. Your app will be rejected if you try and submit it to the app store using this.
Upvotes: 4
Reputation: 5128
No, you'd have to use a third-party library like Mapbox iOS SDK or MBXMapKit.
Upvotes: 2