1、设置cell的间隔

- (void)setFrame:(CGRect)frame{
    frame.size.height -=10;
    [super setFrame:frame];
}

2、刷新row或者section(一定要初始化NSArray和NSIndexSet,不用用字面量初始化 会闪退)

   [myTableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
   [myTableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation:UITableViewRowAnimationNone];

3、TableView的UITableViewAutomaticDimension和estimatedRowHeight

  UITableViewAutomaticDimension:自适应单元格高度 (默认也是这个)

  estimatedRowHeight:是一个预估高度,iOS11之前是为0,在iOS11下,这个值默认为44。减少调用heightForRowAtIndexPath方法以提高性能。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-10
  • 2021-11-28
  • 2021-11-08
猜你喜欢
  • 2021-08-20
  • 2021-10-20
  • 2021-07-03
  • 2021-04-23
  • 2022-01-18
  • 2022-12-23
相关资源
相似解决方案