3
我有一个tableview有几个部分。我想要的是当我从节中选择一个特定的tableview单元格时,我想要该节的标题标题。我看了几个SO问题,但没有发现任何有用的东西。 在此先感谢。如何从选定的tableview单元格获取标题部分标题?
我有一个tableview有几个部分。我想要的是当我从节中选择一个特定的tableview单元格时,我想要该节的标题标题。我看了几个SO问题,但没有发现任何有用的东西。 在此先感谢。如何从选定的tableview单元格获取标题部分标题?
可以拿到冠军与tableviewcell点击方法如下代码
UITableViewHeaderFooterView* header =[self.tableView headerViewForSection:indexPath.section];
NSLog(@"Header text = %@", header.textLabel.text);
在斯威夫特
let sectionHeaderView = table.headerViewForSection(indexPath.section)
let sectionTitle = sectionHeaderView?.textLabel?.text
尝试以下获得冠军,如果您正在使用 “titleForHeaderInSection” 表委托:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let title = self.tableView(tableView, titleForHeaderInSection: indexPath.row)
}