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

Customizing the control with UI Appearance


The control that we created in this chapter can be easily customized by modifying its class code directly. A better approach might be leveraging on UIKit Appearance, adding more flexibility in the way you (or other developers) can adapt the style of this control without modifying the existent class code. We already discussed this feature in Chapter 2, UI Components Overview – UIKit, while discussing UIKit controls. Let's take a look at how to use this with your custom control now.

Track colors are the elements that we will customize to obtain a better integration of ThermostatSlider with different user interfaces.

The only step to make these properties accessible to UI Appearance is to set them as dynamic, as follows:

dynamic var hotTrackColor = UIColor(red:1.0, green:0.4, blue:0.4, alpha: 1.0)

dynamic var coldTrackColor = UIColor(red:0.4, green:0.6, blue:1.0, alpha: 1.0)

Now, from the view controller implementation, you can override the values using...

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