我使用下面的代码得到了一个不可见的 UITableViewCell
NSIndexPath* path = [NSIndexPath indexPathForRow:row inSection:0];
UITableViewCell *cell = [listTableview cellForRowAtIndexPath:path];
path 返回一些东西,但 cell 返回 nil。
看起来上面的代码只能获取可见的UITableViewCell。
欢迎您的评论
最佳答案
docs明确说明它需要可见。
An object representing a cell of the table, or nil if the cell is not visible or indexPath is out of range.
此外,您正在初始化索引,就像您初始化任何其他变量一样,这与它必须是有效的 indexPath 无关。
关于ios - 获取不可见的 UITableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53352613/