iOS开发UITableView随笔

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方法以提高性能。

posted @ 2018-07-11 15:52  ForeverGuard  阅读(123)  评论(0编辑  收藏  举报