SYFlatButton icon indicating copy to clipboard operation
SYFlatButton copied to clipboard

A customized NSButton with modern flat style like bootstrap.

SYFlatButton

Build Status License MIT Platform info

Description

A customized NSButton with modern flat style like bootstrap.

Screenshot

Installation

Requirement

macOS 10.12 and above.

Cocoapods

  1. Add pod 'SYFlatButton' to your podfile
  2. Run pod install

Manual

Dragging SYFlatButton.h and SYFlatButton.m to your project.

Usage

Interface Builder

  1. Create a NSButton
  2. Set its Button Style to Square in order to change the button's height
  3. Set its Button Class to SYFlatButton
  4. Config the styles from the inspector

Programmatically

See more customizable style from SYFlatButton.h

SYFlatButton *button = [[SYFlatButton alloc] initWithFrame:CGRectMake(20.0, 20.0, 60.0, 30.0)];
button.title = @"Code";
button.momentary = YES;
button.cornerRadius = 4.0;
button.backgroundNormalColor = [NSColor blueColor];
button.backgroundHighlightColor = [NSColor redColor];
[self.view addSubview:button];

Credit

Inspired by FlatButton.

License

The MIT License.