所以,我在我的UITableView
中有幾個像刪除,塊等Swipe動作。我想添加標題來分隔我的兩個部分。所以,我添加了一個原型單元格,將其命名爲HeaderCell
,然後進入視圖。我添加了一個名爲headerLabe
的標籤。我的問題是,當我滑動行動時,標題單元格也在移動,這看起來很糟糕。我研究過,並找到了一個解決方案,只是返回單元格的contentView。但是,當我這樣做時,標籤沒有出現。我已經嘗試了十幾種不同的解決方案,並沒有任何成效,所以我轉向了SO。誰能幫我?當我滑動UITableViewCell時,標題視圖也會移動
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerCell : CustomHeaderTableViewCell = tableView.dequeueReusableCellWithIdentifier("HeaderCell") as! CustomHeaderTableViewCell
if section == 0 {
headerCell.headerLabel.text = "Thank You's"
} else if section == 1 {
headerCell.headerLabel.text = "Conversations"
}
return headerCell.contentView
}
非常感謝。