`

UITableView去除多余的横线

    博客分类:
  • ios
阅读更多
查什么东西都他妈的要翻*—^^—*墙, 国内的都好渣,把这贴一下


数据不满的时候UITableView会有很多空线,数据加载之前也会有很多横线,去掉的办法就是给他的footer设置一下:

引用

For iOS 8., 7. and iOS 6.1

The easiest method is to set the tableFooterView property:

- (void)viewDidLoad { 
    [super viewDidLoad]; // This will remove extra separators from tableview 
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; 
}

Or using Storyboard, drag a View to the bottom of the Table View to create a tableFooterView. Set the frame of the tableFooterView to have a height of 0.

For previous versions

You could add this to your TableViewController (this will work for any number of sections):

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { 
    // This will create a "invisible" footer 
    return 0.01f; 
}

and if it is not enough, add the following code too:

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    return [UIView new]; 
    // If you are not using ARC: 
    // return [[UIView new] autorelease];
 }

share|improve this an
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics