我尝试用这段代码将 tableView
中每一行的高度设置为相应单元格的高度:
override func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
var cell = tableView.cellForRowAtIndexPath(indexPath)
return cell.frame.height
}
我在初始化 var cell
时得到这个错误:
线程1: EXC _ BAD _ ACCESS (code = 2,address = 0x306d2c)