views:

205

answers:

1

I would like to have a detail view come in to focus when the user double clicks on a table view row. How would I change a window's view in code?

+4  A: 

The basic idea would be as follows:

- (IBAction)tableViewDoubleClicked
{
    ...

    [window setContentView:myDetailView];
}

Note that this may release the view that was previously used as the contentView for the window, so if you are planning to swap around a couple of different content views, you will need to properly retain them elsewhere.

See Apple's documentation for more details.

e.James