Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top