self.tableView.estimatedRowHeight = 500; self.tableView.rowHeight = UITableViewAutomaticDimension; //并且返回cell高度的代理方法不写 //加载xib ImageLabelCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseID]; if (!cell) { cell = [[NSBundle mainBundle] loadNibNamed:@"ImageLabelCell" owner:nil options:nil].firstObject; } return cell; 在xib中给label约束:上下左右 这样,系统就自动计算label的高度了 如果出现的结果是cell的高度是系统默认的高度,那么说明给的约束不够 错误提示: Warning once only: Detected a case where constraints ambiguously suggest a height of zero for a tableview cell’s content view. We’re considering the collapse unintentional and using standard height instead.