自定义地图路径线 [英] Custom map path line

查看:173
本文介绍了自定义地图路径线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在地图上画一条线时遇到了麻烦。 (内部颜色和外部颜色)我相信我在正确的道路上并且已经将mkOverlayView子类化以覆盖绘图(需要填写道路大小)所以在drawMapRect内...

I'm having trouble with drawing a line on the map with a stroke. (inside color and outside color) I beleive i'm on the right path and have subclassed mkOverlayView to override the drawing (needs to fill with the road size) so inside drawMapRect...

CGFloat lineWidth = MKRoadWidthAtZoomScale(zoomScale);

MKMapRect clipRect = MKMapRectInset(mapRect, -lineWidth, -lineWidth);

  ...

CGContextAddPath(context, path);
CGContextSetStrokeColorWithColor(context, line.color.CGColor);
CGContextSetLineJoin(context, kCGLineJoinRound);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextSetLineWidth(context, lineWidth);
CGContextSetAlpha(context, 0.4f);
CGContextStrokePath(context);

CGPathRelease(path);

我不知道如何添加笔画。任何帮助将不胜感激。 xcode 4.6 / ios 6.0 +

I'm not sure how to add the stroke. Any help would be greatly appreciated. xcode 4.6 / ios 6.0+

推荐答案

首先描绘一条颜色为1的路径(道路),然后将描边宽度和颜色更改为更细的路线颜色为2的颜色为0.6,再次进行冲程。

stroke first a path ( road with) with color 1, then change stroke width and color to a thinner line with road with * 0.6 in color 2, and stroke again.

这篇关于自定义地图路径线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆