Answer the question
In order to leave comments, you need to log in
How to reload accessoryType icons in UITableViewController cells?
Tell me please. In the cellForRowAt method, I wrote an icon in a cell with an inline purchase.
if indexPath.row == 1 {
if isPurchase {
cell.accessoryType = .disclosureIndicator
} else {
let iconLockDisclosureIndicator = UIImage(named: "icon_settings.png")
cell.accessoryView = UIImageView(image: iconLockDisclosureIndicator)
}
}
Answer the question
In order to leave comments, you need to log in
Wrote such a function. I run it in the method with the purchase.
func reloadCell() {
let indexPath = IndexPath(item: 1, section: 0)
tableView.cellForRow(at: indexPath)?.accessoryType = .disclosureIndicator
tableView.reloadRows(at: [indexPath], with: .automatic)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question