JLTGradientPathRenderer渐变线绘制工具
JLTGradientPathRenderer 专门用于绘制渐变线的一款工具,可支持多种颜色,任意边框。
使用示例代码:
func mapView(mapView: MKMapView, rendererForOverlay overlay: MKOverlay) -> MKOverlayRenderer { if overlay is MKPolyline { /* define a list of colors you want in your gradient */ let gradientColors = [UIColor.greenColor(), UIColor.blueColor(), UIColor.yellowColor(), UIColor.redColor()] /* Initialise a JLTGradientPathRenderer with the colors */ let polylineRenderer = JLTGradientPathRenderer(polyline: overlay as! MKPolyline, colors: gradientColors) /* set a linewidth */ polylineRenderer.lineWidth = 7 return polylineRenderer } }
评论