3
我的單元格中有一個標籤,我想在點擊時顯示/隱藏。我知道我必須獲得從didSelectRowAtIndexPath
中獲取的單元格的索引路徑。但我不確定如何在特定的單元格中顯示/隱藏標籤。當UITableView Cell被點擊時隱藏標籤
我可以在didSelectRowAtIndexPath
之內顯示/隱藏它,還是有辦法在cellForRowAtIndexPath
中處理它,然後更新它?
我做了一些研究,但我真的找不到很多。
這裏是我到目前爲止有:
var selectedRowIndex: NSIndexPath = NSIndexPath(forRow: -1, inSection: 0)
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
selectedRowIndex = indexPath
}
您可以從'didSelectRowIndexPath'獲取單元格。 'UITableViewCell * cell = [tableView cellForRowAtIndexPath:indexPath];'並且隱藏這個單元格的標籤。 – Kampai 2014-10-17 12:47:10