PDA

View Full Version : button Touch Drag... (with picture) :(




alexandergre
Nov 25, 2009, 02:32 PM
when you touch and drag you finger from anywhere on the screen the text is "Outside"
but when your finger enters any of the circles the text till change to "Inside".
and when the finger goes outside of the circles the text will be "Outside", again.

I want to be able to drag my finger(touching the screen hole the time) and still be able to change the text. any tips?
I have tried several ways in IB with no success. (touch drag inside outside ...)
I realized that im looking for something like the iPhone keyboard.



alexandergre
Nov 25, 2009, 02:59 PM
what if do like this:

if touch.position=10,13 then label.text= inside.
else if touch.position=23, 34 then label.text= inside.
else if touch.positions= 34, 45 then label. text = inside.
else, label.text= outsite



Would it work?

skunkworker
Nov 25, 2009, 09:44 PM
I would reccomend looking at the Touches Code
http://developer.apple.com/iphone/library/samplecode/Touches/index.html#//apple_ref/doc/uid/DTS40007435

and this line


-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

so you should be checking from the point in the middle of the circle then to the radius outside. Thats how circular based collision detection works.