17 Touch Events and UIResponder

In the next two chapters, you will create TouchTracker, an app that lets the user draw by touching the screen. In this chapter, you will create a view that draws lines in response to the user dragging across it (Figure 17.1). Using multitouch, the user will be able to draw more than one line at a time.

Figure 17.1  TouchTracker

TouchTracker

Touch Events

As a subclass of UIResponder, a UIView can override four methods to handle the four distinct touch events:

  • a finger or fingers touches the screen

    func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?)
    
  • a finger or fingers ...

Get iOS Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.