Turning Touches into Lines

A line is defined by two points. Your BNRLine stores these points as properties named begin and end. When a touch begins, you will create a line and set both begin and end to the point where the touch began. When the touch moves, you will update end. When the touch ends, you will have your complete line.

In BNRDrawView.m, implement touchesBegan:withEvent: to create a new line.

-​ ​(​v​o​i​d​)​t​o​u​c​h​e​s​B​e​g​a​n​:​(​N​S​S​e​t​ ​*​)​t​o​u​c​h​e​s​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​w​i​t​h​E​v​e​n​t​:​(​U​I​E​v​e​n​t​ ​*​)​e​v​e​n​t​ {​ ​ ​ ​ ​U​I​T​o​u​c​h​ ​*​t​ ​=​ ​[​t​o​u​c​h​e​s​ ​a​n​y​O​b​j​e​c​t​]​;​ ​ ​ ​ ​/​/​ ​G​e​t​ ​l​o​c​a​t​i​o​n​ ​o​f​ ​t​h​e​ ​t​o​u​c​h​ ​i​n​ ​v​i​e​w​'​s​ ​c​o​o​r​d​i​n​a​t​e​ ...

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.