2017-01-10 45 views

回答

5

可以拿到冠軍與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 
0

嘗試以下獲得冠軍,如果您正在使用 「titleForHeaderInSection」 表委託:

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 

     let title = self.tableView(tableView, titleForHeaderInSection: indexPath.row) 

    } 
相關問題