1
我使用下面的代碼來填充我的函數的標題:斯威夫特 - 更改標題爲標題部分垂直對齊的TableView中
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
switch section {
case 0: "SECTION 0"
case 1: "SECTION 1"
default: break
}
return nil
}
func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int)
{
var title = UILabel()
title.font = UIFont(name: "HelveticaNeue-Light", size: 12)!
title.textColor = UIColor.blackColor()
let header = view as! UITableViewHeaderFooterView
header.textLabel?.font=title.font
header.textLabel?.textColor=title.textColor
header.backgroundView?.backgroundColor = UIColor.whiteColor()
}
現在,我希望能夠改變垂直下面的圖片標題的部分,像排列:
Changing the vertical alignment of the title in the section of the TableView
我怎麼能這樣做?
完美!我刪除了我正在使用的兩個函數,現在我正在使用函數「func tableView(tableView:UITableView,viewForHeaderInSection部分:Int) - > UIView?」中的代碼,如您所說。謝謝! –
太好了。樂意效勞! – Lahav