ios – 如何镜像UIBezierPath?

前端之家收集整理的这篇文章主要介绍了ios – 如何镜像UIBezierPath?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个UIBezierPath,我想得到它的镜像.我该如何做到这一点?
// Method for generating a path
 UIBezierPath *myPath = [self generateAPathInBounds:boundingRect];

 // ? now I would like to mirror myPath ?
@H_403_5@解决方法
// Method for generating a path
UIBezierPath *myPath = [self generateAPathInBounds:boundingRect];

// Create two transforms,one to mirror across the x axis,and one to
// to translate the resulting path back into the desired boundingRect
CGAffineTransform mirrorOverXOrigin = CGAffineTransformMakeScale(-1.0f,1.0f);
CGAffineTransform translate = CGAffineTransformMakeTranslation(boundingRect.width,0);

// Apply these transforms to the path
[myPath applyTransform:mirrorOverXOrigin];
[myPath applyTransform:translate];
原文链接:https://www.f2er.com/iOS/330408.html

猜你在找的iOS相关文章