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

后端 未结 9 2085
深忆病人
深忆病人 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:18
    - (void)viewDidLoad {
        [super viewDidLoad];
        [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
    }
    
    0 讨论(0)
  • 2020-11-29 01:21

    In Swift:

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

    There is bug a iOS 9 beta 4: the separator line appears between UITableViewCells even if you set separatorStyle to UITableViewCellSeparatorStyleNone from the storyboard. To get around this, you have to set it from code, because as of now there is a bug from storyboard. Hope they will fix it in future beta.

    Here's the code to set it:

    [self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
    
    0 讨论(0)
  • 2020-11-29 01:29

    In interface Builder set table view separator "None"

    and those separator lines which are shown after the last cell can be remove by following approach. Best approach is to assign Empty View to tableView FooterView in viewDidLoad

    self.tableView.tableFooterView = UIView()

    0 讨论(0)
  • 2020-11-29 01:29

    In the ViewDidLoad Method, you have to write this line.

    tableViews.separatorStyle = UITableViewCellSeparatorStyleNone;
    

    This is working Code.

    0 讨论(0)
  • 2020-11-29 01:32

    You can do this in the storyboard / xib editor as well. Just set Seperator to none.

    enter image description here

    0 讨论(0)
提交回复
热议问题