objective-c - 如何获取特定 UITableViewCell 的节号?

标签 objective-c ios ios4 uikit

如何通过特定的UITableViewCell获取原始indexPath.section?

- (NSString *)sectionForCell:(UITableViewCell *)cell {
   //How to get the original indexPath.section by the specific UITableViewCell?
}

最佳答案

UITableView 有一个方法可以为您提供特定单元格的索引路径:

NSIndexPath *path = [self.tableView indexPathForCell:cell];
return path.section;

请注意,这将返回一个整数,而不是一个字符串。

关于objective-c - 如何获取特定 UITableViewCell 的节号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9445292/

相关文章:

ios - 试图找到哪个文本字段处于事件状态 ios

ios - 如何实例化(附加) Storyboard并将其推送到我的应用程序中?

iphone - 在 iOS 7 上读取 iPhone 的通话记录

objective-c - 核心数据 : Automatically select next table row when record deleted

ios - 将自动布局与动态 UITextView、UIImageView 和 UILabel 高度一起使用

iphone - 从 ViewController 设置 UIImageView 图像

ios - 如何使用 swift 编程语言将宏创建为函数

ios - 即使从 Facebook 应用程序设置中删除应用程序后,用户仍可以访问应用程序

ios - 如何在不通过 Interface Builder 获取 UIButton 类的背景的情况下添加图像?

iphone - 我们可以使用应用程序更改设备时间吗?