【问题标题】:Converting a CGPath to a UIImage将 CGPath 转换为 UIImage
【发布时间】:2012-09-22 14:34:43
【问题描述】:

有没有办法将 CGPath 转换为 UIImage?

谢谢

【问题讨论】:

标签: iphone objective-c ios uiimage cgpath


【解决方案1】:
UIGraphicsBeginImageContext(size);
// draw your path here
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();    
UIGraphicsEndImageContext();

【讨论】:

  • 问题是关于 CGPath 而不是文件系统路径。
【解决方案2】:

如果您要问的意思是您在上下文中绘制路径,然后希望将其转换为图像,那么UIGraphicsGetImageFromCurrentImageContext 可能就是您所需要的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-30
    • 2012-07-15
    • 2013-01-01
    • 2015-12-12
    • 2011-09-22
    • 2013-05-04
    相关资源
    最近更新 更多