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

aukemid

macrumors newbie
Original poster
Mar 26, 2010
24
0
I have a UITableView and the rows in this contain buttons.
Now the buttons call a method on the Touch up inside event and when a button is pressed down the table doesn't scroll.

The buttons should only react if the touch doesn't move, so only if I press and release at the same spot. If the touch does move I would like the table to scroll.

Is this possible? Is there a button event that works like this? Can I detect a swipe in the table if it's done over the buttons? And does anyone has example code?
 
It's quite easy to implement..

Though u can't do that with a UIButton.
create a class MyButton that inherits UIImageView (i'm guessing u want an image there). implement the UIView touch methods in the class,
declare a BOOL variable touchMoved and do the following:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
touchMoved = NO;
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
touchMoved = YES;
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
if(!touchMoved){
// Do what u wanna do
}
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.