glkView 和更新方法有什么区别?

What is the difference between glkView and update methods?

当继承 GLKViewController 时,它有两个方法:

这两种方法好像都是每帧调用的。文档内容如下:

As an alternative to implementing a glkViewControllerUpdate: method in a delegate, your subclass can provide an update method instead. The method must have the following signature:

- (void)update;

我应该在我的代码中覆盖哪个,哪个应该包含绘图调用?

这个线程回答了这个问题:Difference between glkView:drawInRect: and glkViewControllerUpdate:? OpenGL ES 2 - iOS

引用:

关于 update() 视图控制器调用其委托的 glkViewControllerUpdate: 方法。您的委托应更新不涉及将结果呈现到屏幕的帧数据。

关于 drawInRect:GLKView 对象将其 OpenGL ES 上下文作为当前上下文并将其帧缓冲区绑定为 OpenGL ES 渲染命令的目标。然后您的委托方法应该绘制视图的内容。