Skip to content

Instantly share code, notes, and snippets.

@lindon-fox
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lindon-fox/efef3050f7b29dc32baa to your computer and use it in GitHub Desktop.
Save lindon-fox/efef3050f7b29dc32baa to your computer and use it in GitHub Desktop.
Cocoa category to style NSButton for PainCode use (with an image only) - For creating the button in code (not in a nib/storyboard)
//
// NSButton+PaintCode.m
// LookUp
//
// Created by Grattan Johnny on 1/10/15.
//
//
#import "NSButton+PaintCode.h"
@implementation NSButton (PaintCode)
-(void)styleForPaintCode{
[self setBordered:NO];
[self setImagePosition:NSImageOnly];
[self setButtonType:NSMomentaryChangeButton];
[self setBezelStyle:NSRegularSquareBezelStyle];
}
@end
//Example usage:
#import "NSButton+PaintCode.h"
//...
self.primaryButton = [[NSButton alloc] initWithFrame:self.restScreenButtonView.primaryButtonRect];
[self.primaryButton styleForPaintCode];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment