我试图tableView使用以下代码将每行的高度设置为相应单元格的高度:
override func tableView(tableView: UITableView!, heightForRowAtIndexPath indexPath: NSIndexPath!) -> CGFloat {
var cell = tableView.cellForRowAtIndexPath(indexPath)
return cell.frame.height
}
Run Code Online (Sandbox Code Playgroud)
初始化时出现此错误var cell:
线程1:EXC_BAD_ACCESS(代码= 2,地址= 0x306d2c)