2015-11-03 92 views

回答

5

您可以在TableViewController與覆蓋更新這個方法:

override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { 
    return 55 
} 
+0

是的,我知道這種方式,但我有我的UITableView –

+0

@PhilippJanuskovecz不同高度的幾個不同的單元格您可以使用'indexPath'爲每個單元格返回不同的值 –

+0

好的,謝謝:) –

0

在你的tableview控制器的這種方法:

override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell? 

請務必加入這一行:

cell.height = yourHeight 
0

您可以在Storyboard上的表視圖中添加Table View Cell Prototype並拖動底部r原型細胞,你可以得到高度細胞你想要什麼。

相關問題