ios uitableview 头部增长图片 一块儿滚动 朋友圈头部图片

实现效果 相似朋友圈头部图片.net

一、设置样式code

//这里须要设置UITableViewStyleGrouped 这个是一块儿滚动 若是是  UITableViewStylePlain 是不滚动的 
    _tableView=[[UITableView alloc]initWithFrame:CGRectMake(x, y, width, height) style:UITableViewStyleGrouped];

二、设置高度  (这一点不少文章都没提到过,我找了半天才找到)blog

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 200;
}


三、设置UIView图片

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

    UIView * view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 300, 200)];
    view.backgroundColor=[UIColor redColor];
    return view;
}


如此这就能够了it


参考资料:io

http://blog.csdn.net/xiaobo16/article/details/7801745table

相关文章
相关标签/搜索