April 2020
Intermediate to advanced
528 pages
15h 40m
English
Open Mandala.xcodeproj and create a new Swift file named ImageSelector. Define a new UIControl subclass within this file.
Listing 18.1 Creating the ImageSelector class (ImageSelector.swift)
import Foundationimport UIKit class ImageSelector: UIControl { }
The interface for this control will be set up much like the existing stack view of buttons. The primary difference, in terms of code, is that the ImageSelector will not be tied directly to the array of emoji images. Instead, it will hold on to an arbitrary array of images, allowing the control to be flexible and reusable.
Let’s start re-creating the interface. Add a property for a horizontal stack view and configure some of its attributes. ...
Read now
Unlock full access