2

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

Peter DeWeese
  • 18,141
  • 8
  • 79
  • 101
Alex Takashi Tanabe
  • 129
  • 1
  • 3
  • 11

1 Answers1

1

You'll need to add a UIGestureRecognizer to your view. You can detect touches as a delegate, and this case will probably do best with a UIPanGestureRecognizer. You'll set the delegate to be yourself and draw the box within -(void)panGestureMoveAround:(UIPanGestureRecognizer *)gesture Here 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.

Community
  • 1
  • 1
Peter DeWeese
  • 18,141
  • 8
  • 79
  • 101