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

标签 iphone ios opengl-es glkview

我是 OpenGL 的新手,我一直试图在 GLKView 上显示一个按钮,但按钮没有显示。这是我所做的...

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];

编辑:

 [glview addSubview:call_btn];

我创建了一个 UIViewController,添加了一个 GLKView 作为 self.view 的 subview ,除上述问题外一切正常(UIbuttons 未显示在 glkview 上)。知道怎么做。

最佳答案

您必须将按钮添加到 GLKView。 如果你添加到 self.view 它们是隐藏的,因为 GLKView 是不透明的并且在它们前面。

关于iphone - 如何使用 UIViewController - IOS 在 GLKView 上显示 UIButton?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16228861/

相关文章:

iphone - UIAlertView 能否通过委托(delegate)传递字符串和 int

objective-c - 访问 NSUserDefaults 时是否需要使用委托(delegate)来维护 MVC 模式?

ios - Objective-C 属性 getter 抛出异常 'Unrecognized selector sent to instance'

iphone - 将应用程序升级到 iPhone 4 : how to get touches to give low-res screen values

iphone - 我将一些数据发送到 Web 服务,它返回一些 JSON 作为 NSData。如何转换为Dict?(iOS 4.3)

jquery - 滚动时在 Web 应用程序上触发悬停状态

ios - 动态 TableViewCell 高度以适合下载的图像

android - 哪些 Android 设备不支持 draw_texture?

iphone - 使用 OpenGL 在 iPhone 上扭曲图像

iphone - 如何在使用动画按下返回键时将新的 UITextField 添加到自定义 UITableViewCell