我是 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/