iOS Developer Library

Developer

GLKit Framework Reference GLKViewDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

GLKViewDelegate

Inheritance


Not Applicable

Import Statement


Swift

import GLKit

Objective-C

@import GLKit;

Availability


Available in iOS 5.0 and later.

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. (required)

    Declaration

    Swift

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

    Objective-C

    - (void)glkView:(GLKView *)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.

    Import Statement

    Objective-C

    @import GLKit;

    Swift

    import GLKit

    Availability

    Available in iOS 5.0 and later.