【发布时间】:2014-04-27 19:30:07
【问题描述】:
有没有一种简单的方法可以在MKMapView 上启用夜间模式,就像太阳下山时 Apple 地图应用程序所做的那样?
我没有在 MapKit 文档中找到这样的东西。
【问题讨论】:
标签: cocoa-touch mkmapview mapkit
有没有一种简单的方法可以在MKMapView 上启用夜间模式,就像太阳下山时 Apple 地图应用程序所做的那样?
我没有在 MapKit 文档中找到这样的东西。
【问题讨论】:
标签: cocoa-touch mkmapview mapkit
不幸的是它是一个私有 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];
我们应该向苹果提交一份雷达,以便向所有人开放。对于在驾驶时在第三方应用程序中使用地图的人来说,这可能是一个安全问题。 如果您尝试使用此方法将其提交到应用商店,您的应用将被拒绝。
【讨论】:
不,您必须使用第三方库,例如 Mapbox iOS SDK 或 MBXMapKit。
【讨论】: