How to set the full width of separator in UITableView

前端 未结 16 856
再見小時候
再見小時候 2020-11-30 19:50

I have a UITableView where the separators don\'t have the full width. It ends like 10 pixels before the left side. I was playing around with this code in the

16条回答
  •  伪装坚强ぢ
    2020-11-30 20:54

    For Swift in iOS 9+

    If using a custom UITableViewCell:

    override var layoutMargins: UIEdgeInsets {
        get { return UIEdgeInsetsZero }
        set(newVal) {}
    }
    

    then for your UITableView in viewDidLoad:

    self.tableView?.separatorInset = UIEdgeInsetsZero;
    self.tableView?.layoutMargins = UIEdgeInsetsZero;
    

提交回复
热议问题