【问题标题】:Apple iOS BreadCrumb Example CGPath Route and GradientApple iOS BreadCrumb 示例 CGPath 路由和渐变
【发布时间】:2013-03-17 05:59:41
【问题描述】:

我正在使用“Apple iOS Breadcrumb”示例使用 CGPath 创建路线,我知道每个加入的 CGPath 都会创建我的路线,并且每个 CGPath 都使用 CGContextSetRGBStrokeColor 填充背景色,但现在,我想填充整个路线渐变绿色到黄色。我该怎么做?

【问题讨论】:

    标签: ios mapkit cgcontext cgpath linear-gradients


    【解决方案1】:

    没有内置支持使用渐变绘制路径。有关详细分析器,请参阅 [a link] (Stroking a CGPath with a gradient?)

    【讨论】:

    • 哦,谢谢先生的回答,那么,我可以使用 CGContextSetStokePattern 将图像插入到我的路线的 CGPath 中吗?我想在每个 CGPath 中插入“arrow.png”,如何才能我这样做?
    • 是的,你可以,UIColor *arrowPattern = [UIColor colorWithPatternImage:[UIImage imageNamed:@"arrow.png"]]; CGContextSetStrokeColorWithColor(context, arrowPattern.CGColor);
    • 但是,UIColor colorWithPatternImage 它将提取图像的颜色,然后在 CGContextSetStrokeColorWithColor(context, arrowPattern.CGColor) 中使用它,但我想要的是插入图像“arrow.png”在(内部)每个 CGPath。
    • 然后你需要绘制图像并用CGPath遮罩它
    • 我正在创建一条 BUS 路线,但我想在路线上使用“arrow.png”来显示道路中 BUS 路线的方向,比如说“这条路的 BUS正在开始路线,为此”使用箭头,为此,我需要在 CGPath 上插入该图像....非常感谢您
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多