Reputation: 1045
I have installed lately XCode 4+, and since on I get warning message 'window' is deprecated. I have subclassed NSView and called it CentralView and used it to load various views dynamically. I had to subclass the NSView, because there are methods I needed to override. In other class that controls loading central views I have created following method:
- (IBAction)showUserInfoView:(id)sender{
NSLog(@"Load new user info page");
// Try to end editing
NSWindow *w = [centralView window]; // Here I get warning 'window' is deprecated
BOOL ended = [w makeFirstResponder:w];
if (!ended) {
NSBeep();
return;
}
// Put the view in the box
NSView *v = [[viewControllers objectAtIndex:0] view];
NSArray* viewSet = [NSArray arrayWithObject: v];
[centralView setSubviews: viewSet];
}
As far as I am aware the window method in NSView is up to date. Why do I get message?
Upvotes: 1
Views: 1082
Reputation: 27994
What type is centralView
? What happens if you say [(NSView*)centralView window]
?
It's possible that the compiler is not finding -[NSView window]
, but some other -window
method which is deprecated. If centralView
is declared as an id
then the compiler doesn't know it's an NSView
and has to guess.
Upvotes: 1