如何镜像UIBezierPath?

wfb*_*ale 11 core-graphics objective-c ios uibezierpath

我有一个UIBezierPath,我想得到它的镜像.我怎么能做到这一点?

 // Method for generating a path
 UIBezierPath *myPath = [self generateAPathInBounds:boundingRect];

 // ? now I would like to mirror myPath ?
Run Code Online (Sandbox Code Playgroud)

wfb*_*ale 24

// 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];
Run Code Online (Sandbox Code Playgroud)