I have an UITableView. There are 5 rows and 4 buttons each in a row. When the user taps the button i want to retrieve the row ID.
I have used UITapGestureRecognizer
to recognise the Button that was selected. Now i want to find the Row the button is.
I wanted to use cell.myButton.tag =indexRow.row;. However, i am not able to receive it from ImageTapped
method. Can someone help me out ?
Following code is part of cellForRowAtIndexPath
cellForRowAtIndexPath
UITapGestureRecognizer *tap = nil;
tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(ImageTapped:)];
[cell.myButton addGestureRecognizer:tap];
... Like wise for the other button as well.
ImageTapped method
- (void) ImageTapped:(UITapGestureRecognizer *) recognizer {
if(recognizer.state == UIGestureRecognizerStateEnded)
{
}
}