【发布时间】:2015-09-15 06:20:18
【问题描述】:
我们可以像这样轻松地从 indexPath 获取 UITableViewCell:
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
但我只有行号而不是索引路径,我正在使用此代码获取单元格。
NSArray *visible = [self.tableView indexPathsForVisibleRows];
NSIndexPath *indexpath = (NSIndexPath*)[visible objectAtIndex:MyRowNumber];
UITableViewCell *tablecell = [self.tableView cellForRowAtIndexPath:indexpath];
告诉我这是否是一个好的方法,如果不是,那是哪一个。
【问题讨论】:
-
看到这个链接可能对你有帮助stackoverflow.com/questions/31649220/…
标签: ios objective-c xcode