分享

自定义TableHeaderView

 萤火与皓月 2015-01-16

 原本打算自己手动设置tabview中的第一行cell,但是需要修改的地方太多了,看到有兄台使用tableHeaderView进行设置,很简单,于是也对其进行了自定义,效果不错。

UITableView 的 cell 默认出现在 uitableview 的第一行,如果你想自定义 UITableViewCell 与导航条间距的话,可以使用下面这行代码

  1. tableview.tableHeaderView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 20)]autorelease];  
Demo

  1. AFImageViewer* afView = [[AFImageViewer alloc] initWithFrame:CGRectMake(0,0, 320, 200)];  
  2. afView.backgroundColor=[UIColor blackColor];  
  3. [afView setContentMode:UIViewContentModeScaleAspectFill];  
  4. afView.delegate=self;  
  5. contentTableView.tableHeaderView = afView;  



    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多