Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

NickFalk

macrumors 6502
Original poster
Jun 9, 2004
347
1
OK here's what I'm trying to achieve:

I want to be able to put my finger down on Button1 and drag my finger to Button2. The idea is that methods called by Button1/TouchDragExit and Button2/Touch Down in combination should perform certain actions. (The connections were all sat up in IB).

Unfortunately though, as Button1 retains the touch until it ends (finger is lifted) and I am unable to get Button2 to register the TouchDragEnter. Is there a way of forcing Button1 to "let go" of the touch without killing it completely? (So that Button2 can register that it enters). Or perhaps some other über-elegant solution that I'm unaware of?

Anyone?

Edit: OK, I figured out that touch drag enter, didn't do what I hoped. It should probably be renamed touch drag re-enter. ;)

Still no go though, I am still unable to register one touch dragging from Button 1 and into Button 2...???
 
Same question

I am trying to do a VERY similar thing with my buttons. So far I only have that buttons are hard to make behave that way, despite the misleading names, touch drag exit only fires when you are FAR FAR AWAY from the button for users with big finger. :confused:

I would really like this to work. I would appreciate at least a suggestion. Would using really small view work? Here is my scenario.

I have a few very small buttons close to each other. For that reason, I need to tell the user what/where he/she is touching, by displaying a zoom of the possible click/button (much like the keyboard).

So if the user really wants to "touch" that button it simply lets go, and the event is registered.

Otherwise, the user should be able to drag his/her finger to the sides, and select the right button by letting go when INSIDE the correct button. Very Keyboard like behavior. I am using buttons, but i can adapt this(even though it would be a pain). Any help please?

Thank you very much.
 
Interesting question. I looked at the keyboard, and noticed that when you press a key, a LARGER button is displayed over the keyboard button that you pressed, which both shows the large letter above your finger and "hides" the keyboard button underneath your finger.

Please forgive me if I'm using the wrong terminology, I'm a newbie iPhone programmer - I may being using the word "View" incorrectly in the following suggestions.

I'm wondering if they have a transparent view on top of the keyboard, so that you're not actually "touching" the separate buttons at all, it just appears that you are.

Under this assumption, you could create a transparent view, and when you detect that they pressed button 1, display a "pressed-looking" fake button 1 on top of the real button 1. Your code would pay attention to where the original touch was, and also where the user lifted...

What do you think?
 
Most likely the keyboard doesn't have UIButtons on it at all. It's just a big image. The view controller that handles it manages all the touch interactions. It knows where all the rects are for all the 'keys' and it does the right thing when the user taps a 'key' or taps and moves from one 'key' to another.

That's how to do this. You have to manage the touches at a higher level than the buttons. I think it might be possible to have actual UIButtons that have their userinteraction property turned off. So all the touch management happens in the container view or view controller. In this way you can get the buttons to draw themselves.
 
thanks

Icewing, thank you for your suggestion. Like PhoneyDeveloper said, I am going to have to figure something like that to make (M)plementation work.:D

I don't think I can fetch the locations of the touch with a UIView though. PhoneyDeveloper, can you please give me a little bit more details on how I can go about to implement this? I appreciate your help. This is only my first app, so I have not much experience.

I think I can easyly as a botton its bounds, so what element would you suggest I use to say something like.

(sudo code)

if (parent.bounds.touched inside button.bounds )
{//show user zoom of button
}

Thank you.
 
I think I can easyly as a botton its bounds, so what element would you suggest I use to say something like

Simplest is an array of rects. Probably you want to write your own class, derived from NSObject, that holds the frame rect and other bits of info about the 'button.'

It might be possible to use UIViews that don't respond to touches. They still draw and they still have a frame. It's also possible that, as I mentioned above, you can use real UIButtons but turn off their touch handling.

Simply put, this is a little complicated. If you only have a few 'buttons' it should be possible to make it work, but it will take some effort.
 
Most likely the keyboard doesn't have UIButtons on it at all. It's just a big image....

Yes, exactly what I was thinking - you put it much more succinctly that I did... :D

Simply put, this is a little complicated. If you only have a few 'buttons' it should be possible to make it work, but it will take some effort.

Agree - I wonder what Apple's keyboard code looks like! :eek:

@NickFalk and @coxaqui, please keep us informed and let us know how you got it working, sounds like something that could be very useful!
 
Agree - I wonder what Apple's keyboard code looks like! :eek:

Does anyone have it?:apple: :p
Well, if anyone has done anything similar to this I would love to take a look at the code if the developer would be kind enough to share it. :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.