Note that there are some explanatory texts on larger screens.

plurals
  1. POAutomatic deselection of table view cell after popping detail view?
    primarykey
    data
    text
    <p>I've been stumped by this for a while...</p> <p>When you tap the cell of a contact in Apple's Phone app for the iPhone (entering the view with contact details) and tap back to the previous view, there is a brief animation (fading from blue to white) showing the deselection of the cell. This is the behavior with all table views in Apple's own apps, and also the recommended behavior according to their Human Interface Guidelines.</p> <p>However, in my own project I've been having trouble replicating this behavior. None of the cells in my <code>UITableView</code> are selected when I return to it from a detail view.</p> <p>I looked through the CoreDataBooks sample code in Apple's documentation, which has the desired cell deselection behavior, and it seems like the table view gets the behavior "automatically" (without any specific implementation).</p> <p>I've also tried implementing the solutions in these very similar questions:</p> <p><a href="https://stackoverflow.com/questions/4757787/what-deselect-selected-cell-when-navigationcontroller-pops-a-view">What deselect selected cell when navigationController pops a view?</a></p> <p><a href="https://stackoverflow.com/questions/897071/iphone-uitableview-cells-stay-selected">iPhone UITableView cells stay selected</a></p> <p><a href="https://stackoverflow.com/questions/6649202/uitableview-doesnt-keep-row-selected-upon-return">UITableView doesn't keep row selected upon return</a></p> <p>But I always get the same result -- none of the cells in the <code>UITableView</code> are selected when I return to it. (Even after adding <code>[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:animated];</code> in the view controller's <code>-viewWillAppear:</code> method.)</p> <p>It was also suggested in the comments of one question that having <code>[[self tableView] reloadData];</code> in <code>-viewWillAppear:</code> may be causing the cells not to stay selected. But CoreDataBooks does the same thing and still has the desired behavior (seemingly) without any specific code.</p> <p>Any suggestions on how to resolve the problem? Thanks in advance.</p> <p>On a side note, I don't quite understand why the code to deselect the cell should be implemented in <code>-viewWillAppear:</code> (rather than <code>-viewDidAppear:</code>). Wouldn't that cause everything to happen before the table view is displayed on screen? This is probably just due to lack of proper understanding of a view's life cycle on my part, but any clarifications would be nice. Thanks again.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload