Re: detecting touch and hold vs touch in UIButton

2010-06-06 Thread Alejandro Marcos Aragón
Hi Matt, thanks for clarifying that. That worked like a charm! I had to override functions: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; But it works just as I want. Thanks again! aa On Jun 6, 2010, at 11:11

Re: detecting touch and hold vs touch in UIButton

2010-06-06 Thread Matt Neuburg
On or about 6/6/10 11:04 AM, thus spake "Scott Andrew" : > You still need that timer. Especially for non 3.2. If you get your > touchEnded before your timer is reached it was just a tap. Right, but my revised solution (which you do not quote) with performSelector and delayed performance *is* ef

Re: detecting touch and hold vs touch in UIButton

2010-06-06 Thread Scott Andrew
You still need that timer. Especially for non 3.2. If you get your touchEnded before your timer is reached it was just a tap. Scott Sent from my iPad On Jun 6, 2010, at 8:54 AM, Alejandro Marcos Aragón wrote: > Hi Matt, > > Thanks for your answer. Still, I don't think that solves the pro

Re: detecting touch and hold vs touch in UIButton

2010-06-06 Thread Matt Neuburg
On or about 6/6/10 8:54 AM, thus spake "Alejandro Marcos Aragón" : > If the user just taps the button, a UISegmentedControl appears, thus this > target is in touch up inside. Now, if the user taps and holds, another type of > control appears after a delay so this has to be done in touch down (beca

Re: detecting touch and hold vs touch in UIButton

2010-06-06 Thread Alejandro Marcos Aragón
Hi Roland, Thanks for answering my question. Shouldn't this be very restrictive though? I don't know the statistics, but I'm pretty sure that there is a large number of people having an old version of the OS. aa On Jun 5, 2010, at 10:04 PM, Roland King wrote: > or if you are coding for 3.2 or

Re: detecting touch and hold vs touch in UIButton

2010-06-06 Thread Alejandro Marcos Aragón
Hi Matt, Thanks for your answer. Still, I don't think that solves the problem. It is not just the difference in time what matters. If the user just taps the button, a UISegmentedControl appears, thus this target is in touch up inside. Now, if the user taps and holds, another type of control app

Re: detecting touch and hold vs touch in UIButton

2010-06-06 Thread Matt Neuburg
On Sat, 05 Jun 2010 21:34:48 -0700, Matt Neuburg said: >On Fri, 4 Jun 2010 21:16:50 -0500, Alejandro Marcos Arag?n > said: >>I've been trying to detect touch and hold vs touch on a subclass of UIButton. > >I think you want to imitate Listing 3-3 of Event Handling in the iPhone >Application Program

Re: detecting touch and hold vs touch in UIButton

2010-06-05 Thread Matt Neuburg
On Fri, 4 Jun 2010 21:16:50 -0500, Alejandro Marcos Arag?n said: >I've been trying to detect touch and hold vs touch on a subclass of UIButton. I think you want to imitate Listing 3-3 of Event Handling in the iPhone Application Programming Guide, handling the touches yourself. m. -- matt neubur

Re: detecting touch and hold vs touch in UIButton

2010-06-05 Thread Roland King
or if you are coding for 3.2 or later, use a UILongPressGestureRecognizer and let it do all the work. On 06-Jun-2010, at 12:36 AM, Scott Andrew wrote: > I believe the way to do this is to setup a timer on touchDown to fire once > after X number of seconds. Your touchUp and touchCancelled shoul

Re: detecting touch and hold vs touch in UIButton

2010-06-05 Thread Scott Andrew
I believe the way to do this is to setup a timer on touchDown to fire once after X number of seconds. Your touchUp and touchCancelled should kill the timer if the timer is exists and is not invalidated. If you hit the timer you are being held. When the timer is hit you restart the timer again fo

detecting touch and hold vs touch in UIButton

2010-06-04 Thread Alejandro Marcos Aragón
Hi all, I've been trying to detect touch and hold vs touch on a subclass of UIButton. I basically accomplished that by doing the following: I first add the following when the button is created: [button addTarget:self action:@selector(sourceSelected:) forControlEvents:UI