我有兩個單元(一個動態等靜態),我要像每個小區設置不同的高度:在我的UITableView特定細胞集高度
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
/*tableView.dequeueReusableCell(withIdentifier: "Cell1", for: indexPath)
tableView.dequeueReusableCell(withIdentifier: "Cell2", for: indexPath)
if cell1 return 100
if cell2 return 20 */
}
這是可能的具體高度爲每個小區不行。
我怎樣才能解決這個問題?
如果您仍然要重新定義手動您必須在細胞地圖由indexPath.row和indexPath.section。您必須知道第2行的實例,因爲此時單元格尚未初始化。 – teixeiras
你得到了點,我不知道爲什麼每個人都在這裏得到的,而不是使用一些通用的方法 –