[英]custom Table View Cell layout in storyboard seems invalid
我在情節提要中自定義表格視圖單元格,以使單元格中的標簽居中。
但似乎沒有任何感情。
我的情節提要是這樣的:
實際上是這樣的:
我只在這樣的代碼中設置標簽的文本:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Movie", for: indexPath) as! ArchiveTableViewCell
cell.showChineseTitle.text = chineseTitleArray[indexPath.row]
return cell
}
為什么?
提前致謝!!!
嘗試添加:
cell.showChineseTitle.textAlignment = .center
因為您沒有為UILable
正確設置文本對齊方式。 但是只能設置它在單元格中的位置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.