How to show UIButton over GLKView with UIViewController - IOS?

1.9k Views Asked by At

I am new to OpenGL, I have been trying to show a button over the GLKView, but buttons are not showing. Here is what I have done...

context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];

    if (!_context) {
        NSLog(@"Failed to create ES context");
    }

    glview = [[GLKView alloc] initWithFrame:self.view.bounds];
    glview.context = _context;
    glview.delegate = (id)self;
    [self.view addSubview:glview];

Edit:

 [glview addSubview:call_btn];

I have created a UIViewController, added a GLKView as subview to self.view, everything working fine except the above problem (UIbuttons are not shown over the glkview). Any idea how to do it.

1

There are 1 best solutions below

0
On

You'll have to add the buttons to the GLKView. If you add to self.view they are hidden because the GLKView is opaque and in front of them.