Drawing

Configure your app's drawing environment using renderers, and draw paths, strings, and shadows.

Topics

Drawing Contexts

Use renderers to turn a set of programmatic drawing commands into a bitmap or PDF image.

class UIGraphicsRenderer

An abstract base class for creating graphics renderers.

class UIGraphicsRendererContext

The base class for the drawing environments associated with graphics renderers.

class UIGraphicsRendererFormat

A set of drawing attributes that represent the configuration of a graphics renderer context.

class UIGraphicsImageRenderer

A graphics renderer for creating Core Graphics-backed images.

class UIGraphicsImageRendererContext

The drawing environment associated with an image renderer.

class UIGraphicsImageRendererFormat

A set of drawing attributes that represent the configuration of a image renderer context.

class UIGraphicsPDFRenderer

A graphics renderer for creating PDFs.

typealias UIGraphicsPDFDrawingActions

A handler block that you use to draw PDF content.

class UIGraphicsPDFRendererContext

A drawing environment associated with a PDF renderer.

class UIGraphicsPDFRendererFormat

A set of drawing attributes that represents the configuration of a PDF renderer context.

Color

class UIColor

An object that stores color data and sometimes opacity (alpha value).

Paths

class UIBezierPath

A path that consists of straight and curved line segments that you can render in your custom views.

func UIRectFill(CGRect)

Fills the specified rectangle with the current color.

func UIRectFillUsingBlendMode(CGRect, CGBlendMode)

Fills a rectangle with the current fill color using the specified blend mode.

func UIRectFrame(CGRect)

Draws a frame around the inside of the specified rectangle.

func UIRectFrameUsingBlendMode(CGRect, CGBlendMode)

Draws a frame around the inside of a rectangle using the specified blend mode.

Strings

class NSStringDrawingContext

An object that manages metrics used when drawing attributed strings.

struct NSStringDrawingOptions

Constants for the rendering options for a string when it is drawn.

enum UIBaselineAdjustment

Vertical adjustment options.

Shadows

class NSShadow

An encapsulation of the attributes used to create a drop shadow during drawing operations.

Drawing Context Primitives

Manage the current graphics environment using Core Graphics framework types.

func UIGraphicsGetCurrentContext()

Returns the current graphics context.

func UIGraphicsPushContext(CGContext)

Makes the specified graphics context the current context.

func UIGraphicsPopContext()

Removes the current graphics context from the top of the stack, restoring the previous context.

func UIGraphicsBeginImageContextWithOptions(CGSize, Bool, CGFloat)

Creates a bitmap-based graphics context with the specified options.

func UIRectClip(CGRect)

Modifies the current clipping path by intersecting it with the specified rectangle.

Primitive Type Conversions

func CGAffineTransformFromString(String)

Returns a Core Graphics affine transform structure corresponding to the data in a given string.

func CGPointFromString(String)

Returns a Core Graphics point structure corresponding to the data in a given string.

func CGRectFromString(String)

Returns a Core Graphics rectangle structure corresponding to the data in a given string.

func CGSizeFromString(String)

Returns a Core Graphics size structure corresponding to the data in a given string.

func CGVectorFromString(String)

Returns a Core Graphics vector corresponding to the data in a given string.

func NSStringFromCGAffineTransform(CGAffineTransform)

Returns a string formatted to contain the data from an affine transform.

func NSStringFromCGPoint(CGPoint)

Returns a string formatted to contain the data from a point.

func NSStringFromCGRect(CGRect)

Returns a string formatted to contain the data from a rectangle.

func NSStringFromCGSize(CGSize)

Returns a string formatted to contain the data from a size data structure.

func NSStringFromCGVector(CGVector)

Returns a string formatted to contain the data from a vector data structure.

See Also

Graphics, Drawing, and Printing

Images and PDF

Create and manage images, including those that use bitmap and PDF formats.

Printing

Display the system print panels and manage the printing process.