Space Between Sections in UITableview

前端 未结 11 2167
醉酒成梦
醉酒成梦 2020-12-08 12:37

I need to reduce the space between two sections ofUITableView. I looked at this question but the solution doesn\'t allow for my custom header view because it c

11条回答
  •  萌比男神i
    2020-12-08 13:26

    Select the tableView in your storyboard/objectCode and ensure that the style is set to "Plain", instead of "Grouped". You can find this setting in the attributes Inspector tab.

    let myTableView : UITableView = {
            let tableView = UITableView(frame: .zero, style: .plain)
            tableView.register(TableCellClass.self, forCellReuseIdentifier: "cellId")
            tableView.backgroundColor = UIColor(red: 123/255, green: 190/255, blue: 120/255, alpha: 1)
            tableView.separatorStyle = .none
            tableView.translatesAutoresizingMaskIntoConstraints = false
            return tableView
        }()
    

提交回复
热议问题