UITableView最上面tableHeaderView留空间的两种方法

来源:互联网 发布:cog数据库官网 编辑:程序博客网 时间:2024/06/05 06:52

 UIView *headerView = [[UIView alloc] initWithFrame: CGRectMake(0032044)];

    m_tableView.tableHeaderView = headerView;

    2)

    m_tableView.contentInset = UIEdgeInsetsMake(44000);

    m_tableView.scrollIndicatorInsets = UIEdgeInsetsMake(44000);

 

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

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

 

[plain] view plaincopyprint?
  1. tableview.tableHeaderView [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, 20)]autorelease];  

Demo

 

[cpp] view plaincopyprint?
  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