【问题标题】:MKMapView night mode like in iOS7 Apple Maps?像 iOS7 Apple Maps 中的 MKMapView 夜间模式?
【发布时间】:2014-04-27 19:30:07
【问题描述】:

有没有一种简单的方法可以在MKMapView 上启用夜间模式,就像太阳下山时 Apple 地图应用程序所做的那样?

我没有在 MapKit 文档中找到这样的东西。

【问题讨论】:

    标签: cocoa-touch mkmapview mapkit


    【解决方案1】:

    不幸的是它是一个私有 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];
    

    我们应该向苹果提交一份雷达,以便向所有人开放。对于在驾驶时在第三方应用程序中使用地图的人来说,这可能是一个安全问题。 如果您尝试使用此方法将其提交到应用商店,您的应用将被拒绝

    【讨论】:

    • 在 swift 中是否可用?似乎无法让它发挥作用。
    【解决方案2】:

    不,您必须使用第三方库,例如 Mapbox iOS SDKMBXMapKit

    【讨论】:

    • 这可能是一个更好的答案,因为简短的答案是否定的。使用私有 API 是不可接受的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-11-10
    • 2013-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-30
    • 2017-01-04
    相关资源
    最近更新 更多