iOS TableView常见问题

Q:表视图只需要部分单元格,怎样删除下方多余的空白单元格?

A:viewDidLoad中添加

  self.tableView.tableFooterView=[[UIView alloc] init];

 

Q: tableView的顶部被navigationBar遮挡

A:

self.tableView.tableHeaderView = navigationBar;

 

消除表格分割线

tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

 

自定义tableViewCell适配tableView的宽度,可以重写自定义cell的setFrame方法

  - (void)setFrame:(CGRect)frame {
    frame.origin.x += inset;
    frame.size.width -= 2 * inset;
    [super setFrame:frame];
  }

 

posted on 2015-04-07 17:19  bibibi_liuliu  阅读(189)  评论(0编辑  收藏  举报