How to change clearsSelectionOnViewWillAppear when not using UITableViewController?
Simply by calling
[myTableView deselectRowAtIndexPath:[myTableView indexPathForSelectedRow] animated:YES];
in your viewWillAppear:
method.
Here the Swift code:
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
if let indexPath = tableView.indexPathForSelectedRow() {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}
}
You are most likely overriding the viewWillAppear:animated
method and missing the [super viewWillAppear:animated]
call.