【发布时间】:2016-07-26 00:41:56
【问题描述】:
我正在使用以下代码来填充函数的标题:
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
我该怎么做?
【问题讨论】:
标签: swift uitableview swift2