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
- Add the QXButton.swift class to your codebase.
- Using InterfaceBuilder, drag a button to a storyboard
- From InterfaceBuilder's Attributes Inspector, change the style of the button to "Square"
- From InterfaceBuilder's Identity Inspector, set the class to "QXButton"
- Returning to the Attribute Inspector, controls will appear for button color, etc.
- Configure and connect your QXButton as you would a standard NSButton.
NOTE: The relative positioning of text and image (when button includes both) is still flakey.