kleydon / Customizable-Button-Demo-OSX-Swift

Customizable button class for cocoa / OSX, written in Swift. Permits customizing colors, border radii, roll-over hover highlighting, and more. Customizeable from within InterfaceBuilder.

Repository from Github https://github.comkleydon/Customizable-Button-Demo-OSX-SwiftRepository from Github https://github.comkleydon/Customizable-Button-Demo-OSX-Swift

Customizable-Button-Demo-OSX-Swift

Demo of a highly customizable button class for cocoa / OSX, written in Swift.

Permits customizing the following, via InterfaceBuilder or via code:

  • Button color (normal and pressed)
  • Border color (normal and pressed)
  • Icon color (normal and pressed) - Supports monochrome images.
  • Icon image (normal and pressed)
  • Text color (normal and pressed)
  • Border Radius (together or one at a time)
  • Roll-over/hover highlighting
  • Glow color
  • Glow radius

Usage:

  1. Add the QXButton.swift class to your codebase.
  2. Using InterfaceBuilder, drag a button to a storyboard
  3. From InterfaceBuilder's Attributes Inspector, change the style of the button to "Square"
  4. From InterfaceBuilder's Identity Inspector, set the class to "QXButton"
  5. Returning to the Attribute Inspector, controls will appear for button color, etc.
  6. Configure and connect your QXButton as you would a standard NSButton.

Implementation:

NOTE: The relative positioning of text and image (when button includes both) is still flakey.

About

Customizable button class for cocoa / OSX, written in Swift. Permits customizing colors, border radii, roll-over hover highlighting, and more. Customizeable from within InterfaceBuilder.

License:MIT License


Languages

Language:Swift 100.0%