ios - 如何镜像 UIBezierPath?

标签 ios objective-c core-graphics uibezierpath

我有一个UIBezierPath,我想得到它的镜像。我怎样才能做到这一点?

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

 // ? now I would like to mirror myPath ?

最佳答案

// 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];

关于ios - 如何镜像 UIBezierPath?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20958408/

相关文章:

ios - 使用 Swift 3.0 实时画线

iphone - 是否可以在Snow Leopard上获得Xcode 4.2的iOS 6.1 SDK?

ios - 如何在相机照片上添加贴纸叠加层

objective-c - 在 Obj-c 中将秒转换为天、分钟和小时

iphone - 处理UIScrollView中UITextField的touchesBegan方法

ios - CoreGraphics - 绘制弧线描边

iOS 静态与动态框架说明

ios - 上传 ionic app itunes connect

objective-c - 在我的 UITableView 上放置渐变以显示单元格

ios - MKMapView 内的自定义核心图形叠加 : can't display stroked ellipse