Observing NSView Bounds
One solution to observer bounds changes in the NSView is to setup a notification in the default notification center and register a selector to respond to the changes.
// Somewhere in your view initialization method.
[self setPostsBoundsChangedNotifications:YES];
NSNotificationCenter *center = [NSNotificationCenter defaultCenter] ;
[center addObserver:self
selector:@selector(boundsDidChangeNotification:)
name:NSViewBoundsDidChangeNotification
object:[scrollView contentView]];
Than add the selector that will be triggered when the notification is received:
- (void)boundsDidChangeNotification:(NSNotification *)notification
{
// ...
}
And this is it. Now the selector boundsDidChangeNotification
can be used to perform any action after the view's bounds change.
Written by Rizo Isrof
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#