Search code examples
iphoneioscocoa-touchquartz-graphicsquartz-2d

drawing a line from gesture between 2 buttons


I am beginner for interactions on iphone. I have 3 buttons, one on the left, and the 2 other ones on the right. I would like to push the left button with finger and display a line real time stretching with my finger moving on screen that goes to the other button I am going to go to on the right - and then I reach the button on the right and release my finger the line stays on screen.

Where should I start in the manual to understand how to do something like this? - please don't say page 1 ;-)

thanks for all the pointers so I can learn and write the code myself

Cheers, geebee


Solution

  • Wow, uh, you're jumping right into the deep end.

    First, the answer to your question is ... check out the Sample Code at developer.apple.com. By playing with those sample projects, and running them in the debugger, and reading that code, you can learn a whole lot about what you're trying to do.

    Using those samples as your tutorial, refer to specific information in the reference docs also available at developer.apple.com. There are specific docs on the classes you'll be using (e.g. UIButton Class Reference), and there are high level guides that talk about different areas, like the Event Handling Guide for iOS, and Drawing and Printing Guide for iOS.

    Here are some of the issues you're going to face, and some of the areas that you should read up on:

    • UIButtons are going to respond to your touch and won't allow any other view to receive that touch without some special handling in your code.

    • Check out samples that deal with UITouch events, Quartz 2D drawing, creating custom controls

    • Try doing this without any buttons first, that's fairly simple. Just figure out how to detect a TouchDownInside event, track the finger movement across the screen, and detect a TouchUpInside event, all in a normal UIView. (There may be a sample for this.)