O'Reilly logo

iOS Programming Cookbook by Hossam Ghareeb

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drawing text, images, lines, rectangles, and gradients

In this section, we will learn to draw simple shapes, gradients, or even images. You will need to draw shapes, lines, and images to create custom components or to use in drawing apps where the user can draw shapes and generate an image of their drawing.

Getting ready

When you need to do any custom drawing in iOS, you will need the help of the Core Graphics framework. This framework is full of cool APIs that you can use to build awesome things. In this section, we will see how to use it to sketch custom drawings in custom UIView. In the following demo, we will draw a custom face with eyes, a nose, and a mouth.

How to do it...

  1. Create a new Xcode project with the Single View Application template ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required