Hi i am working with the tableview.Now i am facing one issue. in my tableview when i use Long Gesture i need to display Alert View.it is working fine.when i click on buttonindex 0 in alert view i need to perform some Task.But in that i need indexpath. Below is my method for perform task
UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc]
initWithTarget:self action:@selector(messageDeleteOrForword:)];
lpgr.minimumPressDuration = 2.0; //seconds
lpgr.delegate = self;
[self.tableView addGestureRecognizer:lpgr];
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
[self deleteSpecificMessage];
}
if (buttonIndex==1) {
}
}
-(void)messageDeleteOrForword:(UILongPressGestureRecognizer *)gestureRecognizer
{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Delete" message:@"Do you want to delete specific message" delegate:self cancelButtonTitle:@"Delete" otherButtonTitles:@"Forword", nil];
[alert show];
}
-(void)deleteSpecificMessage
{
CGPoint p = [gestureRecognizer locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:p];
}
but i need to pass some parameter to know the indexpath for that i use below line -(void)deleteSpecificMessage:(id)sender { } But how to call and assign parameter in alertview Please help me.