ios - 我需要访问 TableViewDelegate 之外的 TableView 的选定行的标题

标签 ios objective-c uitableview

我需要访问 TableView 中选定行的标题。 但是当我需要在 TableViewDelegate 外部访问它时,即出现问题:cellForRowAtIndexPath、didSelectRowAtIndexPath 等。 有没有人可以帮助我。 提前致谢。

最佳答案

这个怎么样?

- (IBAction)ButtonAction:(id)sender {
    CGPoint buttonPosition = [sender convertPoint:CGPointZero toView:tableView];
    NSIndexPath *selectedindex = [tableView indexPathForRowAtPoint:buttonPosition];
   UITableViewCell *Cell  = [tableView cellForRowAtIndexPath:selectedIndexPath];
}

关于ios - 我需要访问 TableViewDelegate 之外的 TableView 的选定行的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35871616/

相关文章:

iOS Objective C - UITableView 性能问题

ios - 从 UITableView 出队后的 UITableViewCell View 不为空

ios - Core Data + Swift + 加载模型不起作用

ios - 快速按下主页按钮时暂停计时器

ios - 如何找到两个 Sprite 之间接触点的法向量

ios - 用 Swift 编写的 UIViewController 可以充当用 ObjC 编写的对象的观察者吗

objective-c - 关闭文档时在 document.m 中调用的方法

ios - 为什么我收到 "Title set but using a system Identifier"警告?

iphone - 更改标签并添加值

ios - 复用UITableViewCells的内部优化有哪些