Home > Store

iOS Drawing: Practical UIKit Solutions

Register your product to gain access to bonus material or receive a coupon.

iOS Drawing: Practical UIKit Solutions

eBook (Watermarked)

  • Sorry, this book is no longer in print.
  • Includes EPUB, MOBI, and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    MOBI MOBI The eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

    Adobe Reader PDF The popular standard, used most often with the free Adobe® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Not for Sale


  • Copyright 2014
  • Edition: 1st
  • eBook (Watermarked)
  • ISBN-10: 0-321-94787-8
  • ISBN-13: 978-0-321-94787-1

Covers iOS 7 and Xcode 5

Apple lavished iOS with a rich and evolving library of resolution-independent 2D drawing utilities. Its APIs include powerful features such as transparency, path-based drawing, anti-aliasing, and more. Harness these low-level, lightweight drawing routines in your apps to build images, to create PDFs, to display views, and to print.

In this guide, Erica Sadun, bestselling author of The Core iOS 6 Developer's Cookbook and The Advanced iOS 6 Developer's Cookbook, helps readers explore iOS drawing through an abundance of examples alongside plenty of explanations and tips. This short work provides the basic how-to developers need to get started. You will learn about these specific topics:

  • The basic concepts of Quartz (Core Graphics) and UIKit drawing
  • The coordinate system, paths, masking, and clipping
  • Text drawing
  • Transparency and alpha channels, drawing modes, blending, colors, and spaces
  • Transforms and geometry
  • Patterns, shadows, and gradients
  • Bitmaps and pixels

Approximately 311 pages.

For related content by author Erica Sadun, see iOS Auto Layout Demystified, The Core iOS 6 Developer’s Cookbook, and The Advanced iOS 6 Developer’s Cookbook.


To access the code samples, visit https://github.com/erica/iOS-Drawing.


Author's Site

Please visit the author's website at https://github.com/erica/iOS-Drawing

Sample Content

Online Sample Chapter

iOS Drawing: Learning Contexts and Basic UIKit Fundamentals

Sample Pages

Download the sample pages (includes Chapter 1)

Table of Contents


How This Book Is Organized

About the Sample Code

Contacting the Author

1    Drawing Contexts


When to Draw


Establishing Contexts in UIKit

Building Contexts in Quartz

Drawing into Contexts

Drawing Within a UIKit Context

UIKit and Quartz Colors

The Painter’s Model

Context State

Context Coordinate System



Setting Line Parameters


2    The Language of Geometry

Points Versus Pixels

View Coordinates

Key Structures

Using CGRectDivide()

Rectangle Utilities

Fitting and Filling


3    Drawing Images

UIKit Images

Building Thumbnails

Extracting Subimages

Converting an Image to Grayscale

Watermarking Images

Retrieving Image Data

Creating Images from Bytes

Drawing and Auto Layout

Building Stretchable Images

Rendering a PDF

Building a Pattern Image


4    Path Basics

Why Bezier

Class Convenience Methods

Building Paths

Retrieving Path Bounds and Centers

Transforming Paths

Fitting Bezier Paths

Creating Bezier Paths from Strings

Adding Dashes

Building a Polygon Path

Line Joins and Caps

Miter Limits

Inflected Shapes


5    Paths in Depth

Path Elements

Converting Bezier Paths into Element Arrays

Legal and Illegal Paths

Math Behind the Path

Calculating Path Distance

Interpolating Paths

Retrieving Subpaths

Inverting Paths

Drawing Shadows

Drawing Inner and Outer Glows

Reversing a Path

Visualizing Path Order


6    Drawing Gradients


Drawing Gradients

Building Gradients

Adding Edge Effects

State and Transparency Layers

Flipping Gradients

Mixing Linear and Radial Gradients

Drawing Gradients on Path Edges

Drawing 3D Letters

Building Indented Graphics

Combining Gradients and Texture

Basic Button Gloss

Adding Bottom Glows

Building an Elliptical Gradient Overlay


7    Masks, Blurs, and Animation

Drawing into Images with Blocks

Simple Masking

Complex Masking


Drawing Reflections

Creating Display Links for Drawing

Building Marching Ants

Drawing Sampled Data

Applying Core Image Transitions


8    Drawing Text

Drawing Strings

iOS 7 Changes

Text Attributes

Kinds of Attributes

Drawing with Core Text

Drawing Columns

Drawing Attributed Text Along a Path

Fitting Text


A    Blend Modes

B    Miter Threshold Limits


Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership