0
A
回答
9
只需创建一个图形上下文,并绘制路径进去,就像这样:
UIGraphicsBeginImageContextWithOptions(path.bounds.size, NO, 0.0); //size of the image, opaque, and scale (set to screen default with 0)
[path fill]; //or [path stroke]
UIImage *myImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
如果你在走动的形象策划,你就需要把它拉进你的看法,或最好一个UIImageView,它是该视图的子视图。这比每次用户移动手指时重新绘制视图都快。
希望这会有所帮助!
+0
第一线对的Xcode警告:'的功能隐式声明“UIGraphicsCreateImageContextWithOptions”是无效的'和建筑失败:'对于架构i386的未定义符号: “_UIGraphicsCreateImageContextWithOptions”' – HSNN
相关问题
- 1. 如何在CGLayer上绘制UIBezierPath?
- 2. 如何使用图像绘制UIBezierPath,删除图像
- 3. 在UIImageView上绘制UIBezierPath
- 4. 如何在图像上绘制图像?
- 5. 如何绘制饼像图中IOS
- 6. iOS - 如何使用UISlider控制UIBezierPath绘图?
- 7. 如何在MKMapView上绘制UIBezierPath覆盖图?
- 8. 在上面绘制图像pdf iOS 5
- 9. 绘制饼图与UIBezierPath
- 10. 在iOS上,为什么UIBezierPath绘图不需要上下文?
- 11. iOS。如何在UIButton上绘制复杂的图像?
- 12. 绘制UIBezierPath到UIImage到Base64图像不在Swift中工作
- 13. 使用UIBezierPath在viewDidLoad中绘制图像:无效的上下文错误
- 14. UIBezierPath在前一个路径上绘制?
- 15. 在代码生成UIView上绘制UIBezierPath
- 16. 使用UIBezierPath绘制像米的半环形图像...!
- 17. 如何在iOS上绘制文字环绕图像?
- 18. 如何在surfaceview上绘制图像android
- 19. 如何在Plots.jl上绘制图像?
- 20. 如何在圆圈上绘制图像
- 21. 如何在屏幕上绘制图像?
- 22. flex如何在图像上绘制
- 23. 如何在窗口上绘制图像?
- 24. 如何绘制可变宽度的UIBezierPath?
- 25. 如何绘制平滑的UIBezierPath签名?
- 26. 如何使用UIBezierpath在touchesEnded的屏幕上绘制一个点
- 27. UIBezierPath没有绘制
- 28. 如何在图像上下文中绘制图像和文本?
- 29. 如何绘制(显示)图像上的用户位置? iOS版
- 30. 如何与文本一起绘制图像上的iOS
看到这个问题第一个答案:http://stackoverflow.com/questions/11739816/ios-uiimage-image-upside-down但不是在上下文中绘制一个UIImage,在上下文 – V1ru8
绘制你的路径,但如何我是否可以绘制该图像? CGContextDrawPath?或者我应该只使用[path stroke]并将其绘制到图像上? – HSNN
http://stackoverflow.com/questions/17408209/how-to-create-a-image-with-uibezierpath/40908425#40908425 – Shrawan