Только первый элемент из массива отображается в ячейках с интервалом.
У меня нет проблем с отображением данных в простых ячейках без пробелов, но когда мне нужно разделить ячейки и изменить свой код, отображается только первый элемент
let test = ["1","2","3"]
func numberOfSections(in tableView: UITableView) -> Int {
return test.count
}
func tableView(_ tableView: UITableView, numberOfRowsInSection
section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
let cellSpacingHeight: CGFloat = 10
return cellSpacingHeight
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = UIView()
headerView.backgroundColor = UIColor.clear
return headerView
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "SellerPlacesCell", for: indexPath) as! SellerPlacesCell
cell.backgroundColor = UIColor.white.withAlphaComponent(0.5)
cell.namePlace.text = test[indexPath.row]
return cell
}
Как это исправить?
если в
func tableView(_ tableView: UITableView, numberOfRowsInSection
section: Int) -> Int {
return 1
}
return 1
я заменяю return 1
на test.count
это: