gpt4 book ai didi

ios - MapKit 中的 MapTypeStyle

转载 作者:可可西里 更新时间:2023-11-01 04:31:29 26 4
gpt4 key购买 nike

我想知道是否有任何方法可以像我们在 Google Maps API 中使用 MapTypeStyle 对象那样配置我们的 MapKit map 。

如果我引用 Apple 文档,MKMapView 有一个采用 MKMapType constant 的 mapType 选项。但没有样式参数,例如 MapOptions 和 MapTypeStyleMapTypeStyler这对于快速定制 map 非常强大。

所以我的问题是:有没有办法用 MapKit 框架实现类似的东西,如果没有,最好的框架/库是什么?我在想 MapBox和类似产品。

最佳答案

我的 friend ,您有几个选择。您可以使用这些框架之一

http://cloudmade.com/products/iphone-sdk

https://github.com/route-me/route-me

或者您可以只使用 mapbox。他们的 api 看起来很不错。或者,您可以提供自己的 map 图 block 和叠加 mapkit。 MKOverlayView 中的类似内容

- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context {

NSURL* fileURL = [(HeatMap*)self.overlay localUrlForStyle:@"alien" withMapRect:mapRect andZoomScale:zoomScale];
NSData *imageData = [NSData dataWithContentsOfURL:fileURL ];
if (imageData != nil) {
UIImage* img = [UIImage imageNamed:@"aTileX.png"];
// Perform the image render on the current UI context
UIGraphicsPushContext(context);
[img drawInRect:[self rectForMapRect:mapRect] blendMode:kCGBlendModeNormal alpha:1.0];
UIGraphicsPopContext();
}
}

如果你想要不受支持的“地形”模式,也可以检查一下 http://openradar.appspot.com/9621632

我实际上正在执行一个需要在 map 上叠加图 block 的程序。 This example很有帮助。您需要查看 MKOverlay 和 MKOverlayView。我正在做的项目涉及使用 gheat .我正在通过 NSURLConnection 访问磁贴并将它们存储在本地。 gist我的实现。

关于ios - MapKit 中的 MapTypeStyle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10354925/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com