NSTextField over NSOpenGLView

前端 未结 7 1946
情歌与酒
情歌与酒 2021-02-08 05:42

I have made a window with an NSOpenGLView that I am rendering openGL content into.

I want to add some buttons and text fields to the view: I can add NSTextFields and NSB

7条回答
  •  孤城傲影
    2021-02-08 05:44

    This was my solution:

    1) Create a parent NSView (let's call it parentView).

    2) Add an NSOpenGLView Child to parentView.

    3) Add an additional NSView Child to parentView (make sure this is after the OpenGLView within the hierarchy). You can add additional TextFields, etc. to this view.

    4) In the ViewController for the parent make sure you call [parentView setWantsLayer: TRUE]; I did this within -(void) viewWillAppear

提交回复
热议问题