gpt4 book ai didi

ios - CAShapeLayer 中的多个路径

转载 作者:技术小花猫 更新时间:2023-10-29 10:21:20 27 4
gpt4 key购买 nike

我想知道是否有可能让 CAShapeLayer 描边不止一条路径,因为实际上它只需要一条路径作为参数,例如:

CAShapeLayer* myLayer=[CAShapeLayer layer];
myLayer.path=myBezierPath

但是如果我想在该图层上绘制不止一条路径怎么办?

最佳答案

使用

void CGPathAddPath (
CGMutablePathRef path1, // The mutable path to change.
const CGAffineTransform *m, // A pointer to an affine transformation matrix, or NULL if no transformation is needed. If specified, Quartz applies the transformation to path2 before it is added to path1.
CGPathRef path2 // The path to add.
);

代码示例:

CGMutablePathRef combinedPath = CGPathCreateMutableCopy(path.CGPath);
CGPathAddPath(combinedPath, NULL, path2.CGPath);
CGPathAddPath(combinedPath, NULL, path3.CGPath);
CGPathAddPath(combinedPath, NULL, path4.CGPath);
myLayer.path = combinedPath;

关于ios - CAShapeLayer 中的多个路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9967157/

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