Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learning iOS UI Development

You're reading from  Learning iOS UI Development

Product type Book
Published in Dec 2015
Publisher
ISBN-13 9781785288197
Pages 196 pages
Edition 1st Edition
Languages

Events and touches


The events managed by iOS during user interaction are grouped into three main sets:

  • Multitouch events are generated by the interaction with the screen

  • Motion events are sensed by the accelerometer

  • Remote-control events are mostly originated by external accessories

Even if these events are extremely different, they can be encapsulated and handled by the same class: UIEvent. An event instance can be easily distinguished by checking its type property, a UIEventType enum, with the following declaration:

enum UIEventType : Int {
    case Touches
    case Motion
    case RemoteControl
}

When users interact with the screen, a multitouch sequence is generated. Each step of a sequence is described by the same UIEvent instance that carries a set of UITouch objects: one per each of the user's fingers taking part in the multitouch sequence.

The event instance remains the same for the whole sequence, and the same is true for the touch instances that are updated during the sequence, preventing...

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 €14.99/month. Cancel anytime}