I'm currently facing an issue with my UITableView. I have set up my cells, but they are not displaying any content. I have set breakpoints and found that the cellForRowAt function is not being called. However, the numberOfRowsInSection and heightForRowAt functions are being executed as expected.
extension DetailPageViewController: UITableViewDelegate, UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 500
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: DetailPageTableViewCell.identifier, for: indexPath) as! DetailPageTableViewCell
print(cell.frame)
cell.selectionStyle = .none
// cell.contentView.layoutIfNeeded()
cell.configure(with: selectedItemVC)
print("configure suc")
return cell
}
}
I have checked that the data source is not empty and that the delegate and dataSource are set correctly.
I have also made sure to call reloadData() on tableView. Despite these, the cellForRowAt function is not being called.
I have already checked this answer but it doesn't work.