gpt4 book ai didi

iphone - 如何使用 UIBezierPath 在除底部以外的所有侧面上绘制描边

转载 作者:行者123 更新时间:2023-12-03 21:07:48 24 4
gpt4 key购买 nike

我创建了一条贝塞尔曲线路径:

UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:rect
byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
cornerRadii:CGSizeMake(10, 10)];

有没有办法只抚摸 4 个边中的 3 个?

最佳答案

是的,通过创建您自己的贝塞尔曲线路径。这就是我们过去是如何做到这一点的。您可以使用 CoreGraphics 上下文应用/描边此路径。应该很容易。我已经调整了示例以绘制没有底部的圆角矩形。

CGFloat width = 100;
CGFloat height = 200;
CGFloat radius = 10;
CGMutablePathRef path = CGPathCreateMutable ();

CGPathMoveToPoint (path, nil, width, 0);
CGPathAddLineToPoint (path, nil, width, height - radius);
CGPathAddArcToPoint (path, nil, width, height, width - radius, height, radius);
CGPathAddLineToPoint (path, nil, radius, height);
CGPathAddArcToPoint (path, nil, 0, height, 0, height - radius, radius);
CGPathAddLineToPoint (path, nil, 0, 0);

CGPathCloseSubpath (path);

关于iphone - 如何使用 UIBezierPath 在除底部以外的所有侧面上绘制描边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5543618/

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