Grouped UITableview remove outer separator line

前端 未结 19 2202
遇见更好的自我
遇见更好的自我 2020-12-02 10:58

I have a grouped UITableview which is created programatically. Also I have a cell with xib file populated in tableview programmatically as well. So far so good. But I want t

19条回答
  •  一向
    一向 (楼主)
    2020-12-02 11:28

    Based on cook's answer, but without a timer:

    override func didAddSubview(_ subview: UIView) {
        super.didAddSubview(subview)
        if NSStringFromClass(subview.classForCoder) != "UITableViewCellContentView" && subview.frame.width == frame.width {
            subview.removeFromSuperview()
        }
    }
    

    Just add this in a cell's subclass and you don't need anything else. Works on iOS 12.

提交回复
热议问题