O'Reilly logo

iOS Programming: The Big Nerd Ranch Guide, 6th Edition by Aaron Hillegass, Christian Keur

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

18 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 18.1). Using multitouch, the user will be able to draw more than one line at a time.

Figure 18.1  TouchTracker

Screenshot shows a detail view controller that has a drawing of an iPhone device at the center.

Touch Events

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

  • one or more fingers touch the screen

    func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
    
  • one or more fingers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required