我已經樣式的標題文字的節頭文字一些保證金:下面添加一個UITableView
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as? TableViewCell
cell!.titleLabel!.text = sections[indexPath.section].objects[indexPath.row].name
cell!.datetimeLabel!.text = "on " + sections[indexPath.section].objects[indexPath.row].date
return cell!
}
func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 100
}
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return sections[section].heading // Open Events
}
而且我想細胞開始的錶款之前,在它下面添加一些保證金/填充。我已在heightForHeaderInSection
上添加了一些邊距/填充頂部。任何方式來添加一些頂部/底部邊距/填充?
您是否可以不使標題高度更大,並將「打開事件」標籤向上移動? – Fonix
使heightForHeaderInSection爲120並嘗試。 – Signare
@Fonix「打開事件」不是標籤,而是我在代碼 – Sayanee