1
テーブルビューでヘッダーセクションのタイトルの垂直方向の配置を変更する:スウィフト - 私は私の関数のヘッダを移入するには、次のコードを使用しています
今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
は、私はそれをどのように行うことができますか?
パーフェクト!私は使用していた2つの関数を削除しましたが、今では関数 "func tableView(tableView:UITableView、viewForHeaderInSectionセクション:Int) - > UIViewの中で自分のコードを使用しています。ありがとうございました! –
助けてうれしい! – Lahav