简体   繁体   English

如何使用UIViewController-IOS在GLKView上显示UIButton?

[英]How to show UIButton over GLKView with UIViewController - IOS?

I am new to OpenGL, I have been trying to show a button over the GLKView, but buttons are not showing. 我是OpenGL的新手,我一直试图在GLKView上显示一个按钮,但是按钮没有显示。 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). 我创建了一个UIViewController,将一个GLKView作为子视图添加到self.view中,除上述问题外,其他所有东西都工作正常(UI按钮未显示在glkview上)。 Any idea how to do it. 任何想法如何做到这一点。

You'll have to add the buttons to the GLKView. 您必须将按钮添加到GLKView。 If you add to self.view they are hidden because the GLKView is opaque and in front of them. 如果添加到self.view,它们将被隐藏,因为GLKView是不透明的,并且位于它们前面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM