Chapter 6: Better Drawing
Your users expect a beautiful, engaging, and intuitive interface. It is up to you to deliver. No matter how powerful your features, if your interface seems “clunky,” you’re going to have a hard time making the sale. This is about more than just pretty colors and flashy animations. A truly beautiful and elegant user interface is a key part of a user-centric application. Keeping your focus on delighting your user is the key to building exceptional applications.
One of the tools you need to create an exceptional user interface is custom drawing. In this chapter you will learn the mechanics of drawing in iOS, with focus on flexibility and performance. This chapter will not cover iOS UI design. For information on how to design iOS interfaces, you should start with Apple’s iOS Human Interface Guidelines and iOS Application Programming Guide, available in the iOS Developer Documentation.
In this chapter, you will learn about the several drawing systems in iOS, with a focus on UIKit and Core Graphics. By the end of this chapter, you will have a strong grasp of the UIKit drawing cycle, drawing coordinate systems, graphic contexts, paths, and transforms. You will know how to optimize your drawing speed through correct view configuration, caching, pixel alignment, and use of layers. You will be able to avoid bloating your application bundle with avoidable prerendered graphics.
With the right tools, you can achieve your goal of a beautiful, engaging, and intuitive ...