views:

47

answers:

0

I'm working on a universal app that uses a SplitViewController to present a master-detail view. In the iPad HIG on Split Views, Apple states:

In general, indicate the current selection in the left pane in a persistent way. This behavior helps people understand the relationship between the item in the left pane and the contents of the right pane. This is important because the contents of the right pane can change, but they should always remain related to the item selected in the left pane.

So I'm trying to maintain selection state on the left. Easy enough when the user taps, I just remove the deselectRowAtIndexPath:animated: message from tableView:didSelectRowAtIndexPath: implementation. But, I also want the selection state to show up by default (without a user tap). I wound up putting this in my tableView:cellForRowAtIndexPath: implementation:

    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    if (cellShouldBeSelected)
        cell.selected = YES;
    else
        cell.selected = NO;
    }

The behavior I'm seeing, is that when the cells finall appear, for a fraction of a section the cell is indeed selected, but then the selection disappears without any user interaction.

Any ideas? I set the new clearsSelectionOnViewWillAppear property to NO, but that doesn't seem to fix it, and it shouldn't really matter because I'm marking the cell as selected long after viewWillAppear is called - I'm actually doing it after some network activity and then sending the table view a reloadData message.