Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning iOS UI Development

You're reading from   Learning iOS UI Development Implement complex iOS user interfaces with ease using Swift

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785288197
Length 196 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (11) Chapters Close

UIKit helpers

Before starting with code, let's have a look at some of the tools provided by UIKit to simplify the drawing process with core graphics. All the functionalities that we will list in this section produce results that can be achieved with core graphics in its "pure" form. You can view these UIKit helpers as shortcuts to some more complex core graphics functions. UIKit and core graphics elements can be easily distinguished by the prefixes of the classes and function names—UI for UIKit and CG for core graphics. You can find all the following code examples in the source code of the chapter.

Drawing with fill and stroke options

The UIKit helpers can be used to alter the current graphic state by defining the current color for fill and stroke drawing actions. These functionalities are part of the UIColor class with its setFill(), setStroke(), and set() functions (the last sets both the stroke and fill colors). Execute the following code:

override func drawRect(rect...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime