Multiple Gesture Recognizers

Let’s add another gesture recognizer that allows the user to select a line. (Later, a user will be able to delete the selected line.) You will install another UITapGestureRecognizer on the BNRDrawView that only requires one tap.

In BNRDrawView.m, modify initWithFrame:.

 ​ ​ ​ ​ ​ ​ ​ ​[​s​e​l​f​ ​a​d​d​G​e​s​t​u​r​e​R​e​c​o​g​n​i​z​e​r​:​d​o​u​b​l​e​T​a​p​R​e​c​o​g​n​i​z​e​r​]​;​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​U​I​T​a​p​G​e​s​t​u​r​e​R​e​c​o​g​n​i​z​e​r​ ​*​t​a​p​R​e​c​o​g​n​i​z​e​r​ ​=​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​[​[​U​I​T​a​p​G​e​s​t​u​r​e​R​e​c​o​g​n​i​z​e​r​ ​a​l​l​o​c​]​ ​i​n​i​t​W​i​t​h​T​a​r​g​e​t​:​s​e​l​f​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.