dengxx
dengxx

Reputation: 41

retain contentView and release NSWindow

_mainView = [[_window contentView] retain]; 
...
[_window release];
_window = nil;
return _mainView;

I meet code snippet above, I want to know what effects it really makes. Thx.

Upvotes: 1

Views: 385

Answers (1)

Parag Bafna
Parag Bafna

Reputation: 22930

Now you are the owner of highest accessible NSView object in the window’s view hierarchy.

NSView  *mainView = [[window1 contentView] retain]; 
[window1 release];
window1 = nil;
[window setContentView:mainView];

Upvotes: 1

Related Questions