的情況下有沒有辦法讓在其中選擇一排段的實例?有可能獲得該部分的索引,所選單元格的索引,所選單元格的實例......但本節的實例?UITableView的didSelectRowAtIndexPath方法獲得選擇部分
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let indexPath = tableView.indexPathForSelectedRow // index path of selected cell
let headerCellIndex = indexPath!.section // index of selected section
let headerCellName = ????? // instance of selected section
let cellIndex = indexPath!.row // index of selected cell
let cellName = tableView.cellForRowAtIndexPath(indexPath!) // instance of selected cell
}
謝謝。
如何您插入節時的tableview負載的名字嗎? – Lee
'字符串(內容[段] .sectionName)' 這也將在'didSelectRowAtIndexPath'-method..But工作是不是有辦法讓節的名稱在某種程度上類似於你怎麼弄的名稱選中的單元格? – manu
是數組/對象的內容嗎? – Lee