這是我試過的。如何垂直對齊tableview標題中的文本swift
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = view as? UITableViewHeaderFooterView
header?.textLabel!.frame = CGRect(x: 0, y: 25, width: tableView.frame.size.width, height: 50)
header?.textLabel?.text = "Testing"
header?.textLabel?.textColor = UIColor.gray
header?.textLabel?.font = UIFont(name: "Avenir-Book", size: 12)
return header
}
仍然沒有辦法在段標題中垂直對齊文本。
任何想法?
你可以發佈圖片,看看你在做什麼,你現在擁有什麼? –
我試過的東西沒有移動任何東西。它仍然是默認的標題標籤外觀。 – mocode10