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

jjgraz

macrumors regular
Original poster
Feb 13, 2009
103
0
Can I do this?
call a method by selecting two different buttons at same time?
Have two separate buttons:

Button 1: when selected calls 'method A'
Button 2: when selected calls 'method B'

the tricky one ----> Buttons 1 & 2: selected at same time calls 'method C'

Any ideas of what to look up or any hints would be greatly appreciated.
Thank you.
 
there is a code for a button double tap, single tap, all the interface touch ups ,in, out ....ect.....

There must be a way to write if button 1 and button 2 are selected....do this. Right?
 
Can I do this?
call a method by selecting two different buttons at same time?
Have two separate buttons:

Button 1: when selected calls 'method A'
Button 2: when selected calls 'method B'

the tricky one ----> Buttons 1 & 2: selected at same time calls 'method C'

Any ideas of what to look up or any hints would be greatly appreciated.
Thank you.

your last option wont be possible since the First Responder will only respond to one object at a time.
 
So any clever programmer idea of out thinking. I have a game controller...sort of like the first Generation Nintendo controller with a couple buttons and a pad.....I need to allow different actions with combination of buttons....... Any ideas? Thank you very much.
 
I'd suggest having one control (perhaps an invisible one that sits over top the visible ones) that captures all touches. Then use touchesBegan:, determine where the touches were detected, map them onto your buttons and handle appropriately.
 
Thank you for the suggestion dejo. I will certainly look into this as a way to handle it.
 
I think you can do this with buttons. A button can respond if another button is already tapped. I have a toolbar in my app. If I tap on one button it highlights. If I hold down my finger and tap on another button it highlights too. The action of the second button isn't sent though. Only the action of the first button is sent.

The point is that the touchdown of your two buttons will be called.

You can see this in the UICatalog app also. Go to the buttons screen and touch one button and hold and then touch a second button. You'll see that both buttons highlight independently.

You need to set up a state machine that performs whatever action is appropriate based on the states of the two buttons. In theory you could change the target/action of the second button when the first button goes down but I would prefer just to use a little logic to determine the state of the two buttons and do the appropriate action.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.