★ TouchArcade needs your help. Click here to support us on Patreon.

One touch 2 buttons?

06-17-2009, 06:43 AM
#1
Joined: Mar 2009
Location: Oslo, Norway
Posts: 731
One touch 2 buttons?

OK guys and gals(?) I'm trying to achieve something that I'm not sure is entirely possible.

I have Button1 and Button2. I want to perform certain tasks if the user "Touch Drag Exits" from Button1 and into Button2. It seems my problem is twofold:
  1. The touch is bound to Button1 for its duration.
  2. It seems there is no standard method for sliding a touch into a button. (Although the latter seems to be exactly how the keyboard works).


Anyone care to share their thoughts on the matter?
06-17-2009, 06:44 AM
#2
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
What about tracking the user's touch location instead of using buttons and when the touch is around a certain x and y then do whatever thing you need?
06-17-2009, 06:50 AM
#3
Joined: Mar 2009
Location: Oslo, Norway
Posts: 731
A great solution, The problem is that I'm too lazy and hoped I could solve the whole thing through IB and convenience methods.
06-17-2009, 09:36 AM
#4
Joined: May 2009
Location: Austin, TX
Posts: 199
Quote:
Originally Posted by NickFalk View Post
A great solution, The problem is that I'm too lazy and hoped I could solve the whole thing through IB and convenience methods.
I think the non-lazy thing to do here IS to track the touches as froggy1233 suggested. Trying to get IB to do what you want will probably take much, much longer. I don't think it supports what you are trying to do. I believe the touch entering a button only works for touches that previously exited that same button.

You can add the touchesBegin and touchesEnd routines right to your custom UIView code. It's a good thing to learn, also, if you haven't done this before.

Developer at IMAK Creations, creator of ColorTilt and other lesser known apps, like That Ain't It!
Blog, twitter
06-17-2009, 01:38 PM
#5
Joined: Mar 2009
Location: Oslo, Norway
Posts: 731
You're quite right about the touch entered. It should have been named re-enter. I do miss a proper enter convenience method though as it really the one piece missing to get my app working as intended.

All in all you're advise is sound and I guess I just have to overcome my lazyness.