关于 tabelviewcell 中 怎么让每个 cell 的 head view 随着 tabelviewhead 滚动

今天遇到了一个问题,在写 tabelview 的时候,我设置了一个 self.tabelview.tabelHeadview,每个 cell 的 headview 都有高度,但是我希望使cell的 headview 随着一起滚动

但是 cell 滚动到一定程度后 headview 会停留一段时间,让 cell 穿透

我解决的办法:因为 tabelview 创建的时候自动默认为 plain 类型的,所以你需要将 tabelview 设置为 group 的

将 tabelview 的 style 类型设置为 group,因为只读的,所以我重写 init 方法,在 init 方法中设置 style

-(instancetype)init{

    if (self = [super initWithStyle:UITableViewStyleGrouped]) {

        return self;

    };

    return nil;

}

 

  

posted @ 2016-02-12 19:45  依然哎  阅读(147)  评论(0编辑  收藏  举报