Revision: 43283
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 20, 2011 22:45 by ramonprades
Initial Code
UILongPressGestureRecognizer *lpHandler = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)];
lpHandler.minimumPressDuration = 0.5; //seconds
lpHandler.delegate = self;
[uiTableView addGestureRecognizer:lpHandler];
[lpHandler release];
···
-(void)longPressHandler:(UILongPressGestureRecognizer *)gestureRecognizer
{
CGPoint p = [gestureRecognizer locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:p];
if (indexPath == nil)
NSLog(@"long press on table view");
else
NSLog(@"long press on row %d", indexPath.row);
}
Initial URL
Initial Description
Detect long touches on any UIView
Initial Title
Long Touch Recognizer
Initial Tags
Initial Language
Objective C