Programmatically defined view in interface builder

2019-08-22 06:45发布

问题:

I have created an OpenGL ES 2.0 view that takes up the iPad's whole screen and I am rendering some things to it.

now I want to resize the view to make it smaller and then add some components to control the content of the opengl view. this view is completely defined programmatically but my goal, because I want to add in some controls, is to use interface builder.

how do I import this OpenGLView into interface builder?

回答1:

I've figured out how to do it. You simply create a UIView in IB and then set the UIView's class identity to your sub-class of UIView that will draw with OpenGL.