首页 > 其他 > 详细

再添加tableviewheader時注意

时间:2016-01-18 12:14:17      阅读:202      评论:0      收藏:0      [点我收藏+]

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section

使用此方法添加header的时候,header不会随着tableview的滚动而滚动

需要注意,重写自定义header(继承自uiview)的setFrame方法,

- (void)setFrame:(CGRect)frame

{

    CGRect sectionRect = [self.tableView rectForSection:self.section];

    CGRect resultFrame = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(sectionRect), CGRectGetWidth(frame), CGRectGetHeight(frame));

    [super setFrame:resultFrame];

}

再添加tableviewheader時注意

原文:http://www.cnblogs.com/ganeveryday/p/5138628.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!