-(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.state != UIGestureRecognizerStateBegan)
return;
CGPoint p = [gestureRecognizer locationInView:myTableView];
NSIndexPath * indexPath = [myTableView indexPathForRowAtPoint:p];
if (indexPath == nil)
NSLog(@"long press on table view but not on a row");
else{
NSLog(@"long press on table view at row %d", indexPath.row);
//!! I want to use TSActionSheet on this line with 'islemlerClicked' function
}
}
Hi,
I want to use TSActionSheet for long press on table cell. I can handle long press;
//viewDidLoad UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
lpgr.minimumPressDuration = 2.0; //seconds lpgr.delegate = self;
[myTableView addGestureRecognizer:lpgr]; //////////////
-(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer { if (gestureRecognizer.state != UIGestureRecognizerStateBegan) return;
CGPoint p = [gestureRecognizer locationInView:myTableView];
NSIndexPath * indexPath = [myTableView indexPathForRowAtPoint:p]; if (indexPath == nil) NSLog(@"long press on table view but not on a row"); else{ NSLog(@"long press on table view at row %d", indexPath.row); //!! I want to use TSActionSheet on this line with 'islemlerClicked' function } }
//////////////////////
-(void)islemlerClicked : (id)sender forEvent:(UIEvent*)event{
TSActionSheet *actionSheet = [[TSActionSheet alloc] initWithTitle:@"İŞLEMLER"];
///..... [actionSheet addButtonWithTitle:@"Yardım" block:^{ NSLog(@"Yardım button");
}]; actionSheet.cornerRadius = 5;
[actionSheet showWithTouch:event];
}
Thanks, Elif