iOS Developer Library — Prerelease

Developer

GLKit Framework Reference GLKViewDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

GLKViewDelegate

An object that implements the GLKViewDelegate protocol can be set as a GLKView object’s delegate. A delegate allows your application to provide a drawing method to a GLKView object without subclassing the GLKView class.

  • Draws the view’s contents.

    Declaration

    Swift

    func glkView(_ view: GLKView, drawInRect rect: CGRect)

    Objective-C

    - (void)glkView:(GLKView * _Nonnull)view drawInRect:(CGRect)rect

    Parameters

    view

    The view requesting that its contents be redrawn.

    rect

    A rectangle that describes the area that needs to be updated.

    Discussion

    The semantics of this method are identical to those of the drawRect: method; the GLKView object makes its OpenGL ES context the current context and binds its framebuffer as the target for OpenGL ES rendering commands. Your delegate method should then draw the view’s contents.

    Availability

    Available in iOS 5.0 and later.