Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing a NSWindow view in code

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?

like image 888
nanochrome Avatar asked Apr 23 '26 14:04

nanochrome


1 Answers

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.

like image 127
e.James Avatar answered Apr 27 '26 16:04

e.James