Skip to content

Instantly share code, notes, and snippets.

@valexa
Last active December 15, 2015 04:09
Show Gist options
  • Save valexa/5199061 to your computer and use it in GitHub Desktop.
Save valexa/5199061 to your computer and use it in GitHub Desktop.
@implementation LaunchButton
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:NSZeroRect options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways | NSTrackingInVisibleRect owner:self userInfo:nil];
[self addTrackingArea:area];
}
return self;
}
-(void)mouseEntered:(NSEvent *)event
{
popupTimer = [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(showPopup) userInfo:nil repeats:NO];
}
-(void)mouseExited:(NSEvent *)event
{
[popupTimer invalidate];
[[NSNotificationCenter defaultCenter] postNotificationName:MAIN_OBSERVER_NAME_STRING object:@"hidePopover"];
}
-(void)showPopup
{
[self animateBlink:self];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment