Check if a UITableViewCell is completely visible

自古美人都是妖i 提交于 2019-12-11 00:57:41

问题


How can I check if a UITableViewCell is completely visible on the screen (not cut off by the tab or nav bar)?

I can get the visible cells with this code:

NSArray *indexes = [_tableView indexPathsForVisibleRows];

but I want to exclude cells that are not entirely visible in the screen.


回答1:


As you have, get the visible cells. The only ones that might be partial are the top and bottom ones. For each, check if its rect (rectForRowAtIndexPath:) is fully within the bounds of the table view (based on contentSize and contentOffset, using CGRectContainsRect).



来源:https://stackoverflow.com/questions/17309364/check-if-a-uitableviewcell-is-completely-visible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!