Graphics & Animation Starting Point
iOS provides several different frameworks for adding graphics and animations to your apps. UIKit is an Objective-C API that provides basic 2D drawing, image handling, and ways to animate user interface objects. Core Graphics is a C-based API that supports vector graphics, bitmap images, and PDF content. Core Animation is another Objective-C API that adds smooth motion and dynamic feedback to the user interface. OpenGL ES is the mobile version of OpenGL for high-performance 2D and 3D drawing. OpenGL ES includes EAGL, an Objective-C API that integrates OpenGL ES with Core Animation and UIKit.
Contents:
Get Up and Running
To use UIKit for basic graphics operations in your user interface:
Read View Programming Guide for iOS to get an understanding of such things as the view hierarchy, the native coordinate system for iOS, and the operations you can perform on views.
Read Drawing and Printing Guide for iOS to learn how to perform drawing tasks using UIKit. CGContext Reference describes most of the functions you’ll use for drawing.
Read UIImageView Class Reference and UIImage Class Reference to use images in your application. To allow the user to zoom images, read UIScrollView Class Reference, and UIScrollViewDelegate Protocol Reference.
When you need more powerful 2D drawing capabilities, use the Core Graphics framework. It’s the workhorse for drawing vector graphics, lines, shapes, patterns, gradients, images, and even PDF documents.
Read Overview of Quartz 2D to learn how drawing works in Core Graphics. (Quartz 2D is the term used for the 2D drawing engine in Core Graphics.) To find out how to perform specific drawing tasks—for example, creating a pattern, path, or gradient—read the appropriate chapter in Quartz 2D Programming Guide.
Core Animation is the programming interface that the UIKit framework uses for layering and transitions in its classes. Use Core Animation if your application requires fine-grained control over animations.
Read the Animations chapter in View Programming Guide for iOS to get you started animating views.
The MoveMe sample application contains examples of animating views and shows how to set up keyframe animations.
You use OpenGL ES to develop games and other applications that require the advanced graphics capabilities provided by the GPU.
Read OpenGL ES Overview, provided by Khronos, the industry consortium that maintains the specifications for OpenGL ES.
Next, examine the GLSprite sample application in Xcode.
Become Proficient
For details on UIKit classes, see UIKit Framework Reference.
For details on Core Graphics, see Core Graphics Framework Reference.
To get a more in-depth understanding of animation, read Core Animation Programming Guide and refer to the MoveMe sample application.
For how to best take advantage of OpenGL ES on iOS, read OpenGL ES Programming Guide. For details on OpenGL ES, see OpenGL ES Framework Reference.
Copyright © 2018 Apple Inc. All rights reserved. Terms of Use | Privacy Policy | Updated: 2015-03-09