Is there a way to remove the separator line from a UITableView?

后端 未结 9 2086
深忆病人
深忆病人 2020-11-29 01:00

I\'m looking for a way to completely remove the separator line in a UITableView when in the plain mode. This is done automatically in grouped, but this also changes the dime

相关标签:
9条回答
  • 2020-11-29 01:35

    You can do this with the UITableView property separatorStyle. Make sure the property is set to UITableViewCellSeparatorStyleNone and you're set.

    Objective-C

    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    

    In Swift (prior to 3)

    tableView.separatorStyle = .None
    

    In Swift 3/4/5

    tableView.separatorStyle = .none
    
    0 讨论(0)
  • 2020-11-29 01:42

    In your viewDidLoad:

    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)])
    {
        [self.tableView setSeparatorInset:UIEdgeInsetsZero];
    }
    
    0 讨论(0)
  • 2020-11-29 01:43

    I still had a dark grey line after attempting the other answers. I had to add the following two lines to make everything "invisible" in terms of row lines between cells.

    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.separatorColor = [UIColor clearColor];
    
    0 讨论(0)
提交回复
热议问题