I’m making a Schedule App for Cocoa Touch and I need to be able to select a time interval just by touching the screen. I mean, the user must be able to select with its fingers a time interval within the “ScheduleView” and then Add an event.
I was thinking of making some kind of rectangular selection, similar to the one that everyone can do in Windows Desktop, but i don’t know how to detect multiple touches, neither how to draw the selection rectangle. Can anyone help me?
P.S: The “ScheduleView” it’s a UIView, not a UITableView
You’ll need to add a
UIGestureRecognizerto your view. You can detect touches as a delegate, and this case will probably do best with aUIPanGestureRecognizer. You’ll set the delegate to be yourself and draw the box within-(void)panGestureMoveAround:(UIPanGestureRecognizer *)gestureHere is a tutorial.To draw the box, you could manually draw into the view but it may be easier to reshape a UIView on top and manipulate its border width and color like this SO question.