Team,
I have UITableView with which have 50 plus cells count. width of each cell is 60.
when I scroll up-to 20 cell, then tap on any cell
Its gives the index-path value above cell value not click cell value
Inside CellForRowAtIndexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
[[cell checkButton] addTarget:self action:@selector(checkButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)checkButtonAction:(id)sender
CGPoint touchPoint = [sender convertPoint:CGPointZero toView:self.tableview];
NSIndexPath *indexPath = [self.tableview indexPathForRowAtPoint:touchPoint];
UIButton *button = (UIButton *)sender;
}
If selected index is 21 gives index 20, keeping index count start from zero.
The issue was observed in iOS 10.1 iphone 7 plus device, Not in simulator iPhone 7 plus iOS 10.1 (14B72)
Debugging value {length = 2, path = 0 - 14}
NSIndexPath path should be 0 - 15 but it gives 0 - 14.
Button click method
If any query about this code then put your comment in answer . Good Luck
Happy Coding.