Skip to content

Instantly share code, notes, and snippets.

@TomLiu
Created November 8, 2012 08:44
Show Gist options
  • Save TomLiu/4037610 to your computer and use it in GitHub Desktop.
Save TomLiu/4037610 to your computer and use it in GitHub Desktop.
change NSButton cursor
//
// CustomCursorButton.h
// demo
//
// Created by 61 on 11/8/12.
// Copyright (c) 2012 61. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface CustomCursorButton : NSButton
@property (nonatomic, strong) NSCursor *cursor;
@end
//
// CustomCursorButton.m
// demo
//
// Created by 61 on 11/8/12.
// Copyright (c) 2012 61. All rights reserved.
//
#import "CustomCursorButton.h"
@implementation CustomCursorButton
- (void)resetCursorRects
{
if (self.cursor) {
[self addCursorRect:[self bounds] cursor:self.cursor];
} else {
[super resetCursorRects];
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment