24 Apr 2010
Cocoa Tip: Losing UITableView Selection
In porting Dollar Clock from the iPhone to the iPad, I switched from using a flip view (using UIModalTransitionStyleFlipHorizontal) to a popover view (UIPopoverController). But a strange thing happened: the UITableView in the popover lost its initial selection, after viewDidAppear was called. Regardless of what I did, the row was always deselected, and indexPathForSelectedRow would go from returning the correct path to nil. Turns out I needed to reloadData before assigning it an initial selection.