解决方案 »

  1.   

    主要是动态高度的问题。需要自己计算,将计算后的高度在cellForRowAtIndexPath中设置成cell 的高度。按下面的步骤去做
    1. 在自定义的uiview中,公开一个内容高度的属性如contentHeight.这个属性你要在自定义的uiview中自己计算
    2. 在将这个view添加到cell上时,在cellForRowAtIndexPath 中在返回cell之前需要重置cell 的高度
    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
             UITableViewCell *cell = .......;
             UIView *customView = .....;
            cell.addSubview(customView);       //////重置cell的高度
          CGRect currentCellFrame = cell.frame;
          currentCellFrame.size.height = customView.contentHeight; //////计算得到的实际高度
         cell.frame = currentCellFrame;
          return cell;
    }3. 这一步也很关键,取cell的高度也是使用的协议方法,所以我们需要在这个协议方法中返回
    -(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *) indexPath {
           UITableViewCell *cell = [self tableView:tableView  cellForRowAtIndexPath: indexPath];
           return cell.frame.size.height;   //////返回cell的实际高度
    }
      

  2.   

    我大概是这么做的,但是cell在滑动的时候,出现了卡顿的情况,锁业我在想怎么解决?