0
我使用動態單元格的UITableView。每個單元格都有一些按鈕,一個圖像和一個標籤。圖像的寬度等於tableview寬度,高度是可變的。UITableView是laggy和滾動時跳轉
我正在用函數更新cellForRowAtIndexPath中圖像的高度以尊重寬高比。標籤可以有一個或多個行。
我正在使用heightForRowAtIndexPath來設置單元格的高度。我正在計算它並返回值。
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
let queficient = CGFloat(dataController.Data[indexPath.row].width)/self.view.frame.size.width
let imgHeight = CGFloat(dataController.Data[indexPath.row].height)/queficient
return 134 + imgHeight + heightForView(dataController.Data[indexPath.row].description)
}
我不知道爲什麼表格有點滯後,當我滾動時跳躍。