Add the delegate -viewWillMoveToWindow to the view subclass contain the table. here i have used the BOOL
named reloadTable
. NSTrackingArea is the answer for your problem
- (void) viewWillMoveToWindow:(NSWindow *)newWindow
{
// Setup a new tracking area when the view is added to the window.
NSTrackingArea* trackingArea = [[NSTrackingArea alloc] initWithRect:[yourTable frame]
options: (NSTrackingMouseEnteredAndExited |
NSTrackingActiveAlways|NSTrackingEnabledDuringMouseDrag) owner:self userInfo:nil];
[self addTrackingArea:trackingArea];
}
- (void) mouseEntered:(NSEvent*)theEvent {
reloadTable=YES;
NSLog(@"enter %@",theEvent);
}
- (void) mouseExited:(NSEvent*)theEvent {
reloadTable=YES;
}
then use it in your NSTableViewDataSource
methods