小编rom*_*m_j的帖子

UIBezierPath减去路径

通过使用[UIBezierPath bezierPathWithRoundedRect:byRoundingCorners:cornerRadii:],我可以创建一个圆形视图,如下所示:

圆形视图

我怎样才能从这一个(或其他方式)中减去另一条路径,以创建这样的路径:

减去视图

我有什么方法可以做这样的事情吗?伪代码:

UIBezierPath *bigMaskPath = [UIBezierPath bezierPathWithRoundedRect:bigView.bounds 
                                 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)
                                       cornerRadii:CGSizeMake(18, 18)];
UIBezierPath *smallMaskPath = [UIBezierPath bezierPathWithRoundedRect:smalLView.bounds 
                                     byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)
                                           cornerRadii:CGSizeMake(18, 18)];

UIBezierPath *finalPath = [UIBezierPath pathBySubtractingPath:smallMaskPath fromPath:bigMaskPath];
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uibezierpath

47
推荐指数
6
解决办法
3万
查看次数

标签 统计

iphone ×1

objective-c ×1

uibezierpath ×1