ios - 获取不可见的 UITableViewCell

标签 ios objective-c uitableview

我使用下面的代码得到了一个不可见的 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/

相关文章:

objective-c - NSURLConnection 与 NSData + GCD

iOS:在 UIWebView 的顶部显示模态视图

iphone - 错误记录(在try-catch的catch block 中)iPhone

ios - 摆脱表格 View 单元格中的重叠图像

iphone - 如何从 uitableview 中的选定行填充标签字段

ios - 使用 Swift 5 的 Vapor 安装问题(第一次使用 Vapor)

ios - 将谷歌云端点 iOS 客户端指向开发服务器

ios - 当滚动方向为水平时,从左到右填充 UICollectionView

iphone - iOS : Hide status bar in entire app programmatically not even through plist

ios - 如何从 UITableView 滑动触发 segue 以快速编辑