Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a visible top row from the UITableView

I should want to play video in to the UITableView top cell/row. My problem is that. How to play video into a top visible row and how to recognised the top cell of the UITableView, while we will scroll the UITableView up and down.

like image 238
Sankalap Yaduraj Singh Avatar asked Jan 21 '26 15:01

Sankalap Yaduraj Singh


1 Answers

You can use UITableView's -indexPathsForVisibleRows or -indexPathForRowAtPoint.

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
    NSIndexPath *topVisibleIndexPath = [[self.yourtableView indexPathsForVisibleRows] objectAtIndex:0];
    NSLog(@"top visible cell's section: %i, get row: %i", topVisibleIndexPath.section, topVisibleIndexPath.row);
}

for additional reference

like image 188
Anbu.Karthik Avatar answered Jan 24 '26 08:01

Anbu.Karthik