简体   繁体   English

如何知道当前正在显示 UITableView 的哪些单元格(行和部分)?

[英]how to know which cells (row & section) of a UITableView are currently being displayed?

Is there a way to know which rows/sections are being displayed inside a UITableView?有没有办法知道 UITableView 中显示了哪些行/部分? I know I can use the function:我知道我可以使用 function:

tableView:(UITableView *) tableView willDisplayCell:(UITableViewCell *) cell forRowAtIndexPath:(NSIndexPath *)indexPath

But, this doesnt help me.但是,这对我没有帮助。 For any given moment, I want to know which row/sections are being displayed and do some processing based on that.对于任何给定的时刻,我想知道正在显示哪些行/部分,并在此基础上进行一些处理。

Can anyone kindly help me?任何人都可以帮助我吗? Thanks.谢谢。

At any given moment, you can retrieve the visible cells from the table view, or index paths:在任何给定时刻,您都可以从表格视图或索引路径中检索可见单元格:

-(NSArray *)visibleCells;
-(NSArray *)indexPathsForVisibleRows;

Check UITableView Class Reference检查UITableView Class 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM