Book Image

Learning iOS UI Development

Book Image

Learning iOS UI Development

Overview of this book

Through this comprehensive one-stop guide, you’ll get to grips with the entire UIKit framework and in a flash, you’ll be creating modern user interfaces for your iOS devices using Swift. Starting with an overview of the iOS drawing system and the available tools, you will then learn how to use these technologies to create adaptable layouts and custom elements for your applications. Next, you’ll be introduced to other topics such as animation and code-drawing with Core Graphics, which will give you all the knowledge you need to create astonishing user interfaces. By the end of this book, you will have a solid foundation in iOS user interface development and will have gained valuable insights on the process of building firm and complex UIs.
Table of Contents (16 chapters)
Learning iOS UI Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Responder chain


An application can handle different kind of events thanks to responder objects. These objects implement specific methods that are useful to respond to one or more events. The UIResponder class is the base class where an interface for these events is defined; therefore, most of the classes that are directly exposed to user interaction are subclasses of UIResponder, such as UIView, UIViewController, UIControl, and even the UIApplication class.

A touch event is propagated through the application structure following an explicit path: the event is generated by the system and added into the event queue; the UIApplication singleton gets the topmost event and propagates it to the key window that, in turn, identifies the view where the touch occurred and passes the event to this view.

Hit-testing

The process through which this view is defined is called hit-testing, and it mainly relies on the hitTest(_:withEvent:) method. The logic is extremely simple: given a touch position, the hit...