问题描述
我正在尝试从我的 EAGLView 中显示的内容中获取 UIImage.有关如何执行此操作的任何建议?
I am trying to get a UIImage from what is displayed in my EAGLView. Any suggestions on how to do this?
推荐答案
正如下面的 demianturner 所述,您不再需要渲染图层,您现在可以(并且应该)使用更高级别的 [UIViewdrawViewHierarchyInRect:]
.除此之外;这应该是一样的.
as demianturner notes below, you no longer need to render the layer, you can (and should) now use the higher-level [UIView drawViewHierarchyInRect:]
. Other than that; this should work the same.
EAGLView
只是一种视图,其底层的CAEAGLLayer
只是一种层.这意味着,将视图/图层转换为 UIImage 的标准方法将工作.(链接的问题是 UIWebview 的事实并不重要;那只是另一种视图.)
An EAGLView
is just a kind of view, and its underlying CAEAGLLayer
is just a kind of layer. That means, that the standard approach for converting a view/layer into a UIImage will work. (The fact that the linked question is UIWebview doesn't matter; that's just yet another kind of view.)
这篇关于如何从 EAGLView 获取 UIImage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!