Reputation: 3512
I am new to osx developing I have read on documentations about windowDidResized:
method , but I am failing to get its delegate .
It is never get called for me , I have included appKit/appKit.h as it said in docs
but the delegate method never triggers
(I am trying to get it inside my NSViewController
)
can some one please make a simple example how do i get that delegate please?
what I have tried to do is:
-(void)loadView
{
//blabla
self.view.window.delegate = [self.view.window delegate];
//blabla ..
}
- (void)windowDidResize:(NSNotification *)notification
{
NSLog(@"window Resized");
}
I am expecting non xib usage samples please :) thanks a lot in advance.
Upvotes: 0
Views: 525
Reputation: 12782
A view probably shouldn't be a window's delegate. Normally the delegate for a window would be a controller object in the Model View Controller paradigm.
You can however use NSNotificationCenter to add an object as an observer for a specific NSNotification from a specific object. ( be sure to remove the observer in its dealloc method if not earlier )
NSWindow class sends many different notifications.
Upvotes: 1