Answers for "uitableview set space between cells"

0

uitableview set space between cells

// Replace table rows with sections by extending UITableViewDelegate
// now we use indexPath.section instead of indexPath.row

// set 1 row for each section
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
	return 1
}
// set distance between each table cell
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
	return 16.00
}
// hide header section
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
	let headerView = UIView()
	headerView.backgroundColor = UIColor.clear
	return headerView
}
Posted by: Guest on March-23-2022

Code answers related to "uitableview set space between cells"

Code answers related to "Swift"

Browse Popular Code Answers by Language