How to get UIImage from EAGLView?

后端 未结 6 493
悲&欢浪女
悲&欢浪女 2020-11-28 09:09

I am trying to get a UIImage from what is displayed in my EAGLView. Any suggestions on how to do this?

6条回答
  •  伪装坚强ぢ
    2020-11-28 09:30

    EDIT: 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.

    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.)

提交回复
热议问题