Matthieu Riegler
Matthieu Riegler

Reputation: 54888

MKMapView night mode like in iOS7 Apple Maps?

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

Answers (2)

Matt
Matt

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

incanus
incanus

Reputation: 5128

No, you'd have to use a third-party library like Mapbox iOS SDK or MBXMapKit.

Upvotes: 2

Related Questions