Here is my implementation.
lazy var reviewTV: UITableView = {
let tv = UITableView()
tv.separatorStyle = .none
tv.showsVerticalScrollIndicator = false
tv.rowHeight = UITableView.automaticDimension
tv.estimatedRowHeight = UITableView.automaticDimension
tv.backgroundColor = .clear
tv.contentInset = .zero
tv.dataSource = self
tv.delegate = self
tv.mj_footer = refreshFooter
tv.register(CombinedViewCell.self, forCellReuseIdentifier: CombinedViewCell.identifier)
return tv
}()
And
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
if selectedRow > 0 {
let indexPath = IndexPath(row: selectedRow, section: 0)
reviewTV.performBatchUpdates(nil) { [weak self] _ in
self?.reviewTV.scrollToRow(at: indexPath, at: .top, animated: false)
}
showGuiderView(from: vm.dataSource[selectedRow].reviewContent)
}
}
I'm facing difficulty to scroll to selected index position. My tableview cell height may be over the intended height for 1 content. Suspect due to rendering issues.
Hope could get help on this, let me know if needed further information or code snippets.