- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
NSTrackingArea *area =[[NSTrackingArea alloc] initWithRect:dirtyRect options:NSTrackingMouseEnteredAndExited|NSTrackingActiveInKeyWindow owner:self userInfo:nil];
[self addTrackingArea:area];
}
// 鼠标进入
- (void)mouseEntered:(NSEvent *)event{
NSLog(@"mouseEntered ========== ");
}
// 鼠标退出
- (void)mouseExited:(NSEvent *)event{
NSLog(@"mouseExited ---------- ");
}