实现UITableView Plain样式section headView和tableview的一起滑动,
在自定义HeadSectionView中重写setFrame方法:
- (void)setFrame:(CGRect)frame{ CGRect sectionRect = [self.tableView rectForSection:self.section]; CGRect newFrame = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(sectionRect), CGRectGetWidth(frame), CGRectGetHeight(frame)); [super setFrame:newFrame]; }
This link 米农,码农blog建设中,欢迎访问.