【发布时间】:2018-10-21 21:56:28
【问题描述】:
我正在使用以下代码从手绘创建图像:
UIGraphicsBeginImageContext(self.bounds.size);
for (UIBezierPath *path in self.pathArray) {
[self.lineColor setStroke];
[path stroke];
}
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
我只想拍摄黑线(绘图)而不是整个视图的图像。视图大小为 300x300。但如果我的绘图是 50x50,那么我只想专注于那部分。
我试过了
UIGraphicsBeginImageContext(signPath.bounds.size);
signPath 是 UIBezierPath 对象。但是有了这个,我得到了空白图像。
有什么建议吗?
【问题讨论】:
标签: ios objective-c uiimage uibezierpath