How to set selectionStyle to none in NavigationRow
Nikoloutsos opened this issue · comments
Hey,
how can I get rid of the the default selectionStyle. I don't want the cell to stay gray after clicking it.This may be something really trivial but I am a beginner in iOS.
let language = NavigationRow(text: "Language", detailText: .value1("Ελληνικά"), icon: .named("call"), action: { _ in })
tableContents = [
Section(title: "App settings", rows: [
language,
NavigationRow(text: "UITableViewCell", detailText: .subtitle(".subtitle"), action: { _ in }),
NavigationRow(text: "UITableViewCell2", detailText: .subtitle(".subtitle"), action: { _ in })
])
]
I found a solution.
..., action: { _ in self.tableView.deselectRow(at: IndexPath(row: 0, section: 0), animated: false) })
This will do the work!
Hi @Nikoloutsos, you might find tableView.indexPathForSelectedRow
handy.
Also, be careful not to have a strong reference to self (i.e. QuickTableViewController) in the action closure. It'll cause a retain cycle.
..., action: { [weak self] in
if let indexPath = self?.tableView.indexPathForSelectedRow {
self?.tableView.deselectRow(at: indexPath, animated: true)
}
})
Hope it helps.