Latest 0.0.7
Homepage https://github.com/kylelol/KKFloatingActionButton
License MIT
Platforms ios 8.0, requires ARC
Dependencies MaterialKit
Frameworks UIKit, QuartzCore
Authors

Version
License
Platform

KKFloatingActionButton is very customizable, Material Design-like menu, inspried by the Inbox app made by Google.

Screencapture GIF

Usage

To run the example project, clone the repo, and run pod install. Open the .xcworkspace, change the build target to ‘Example’, and build and run.

Requirements

iOS 8+
Swift 1.2

Installation

KKFloatingActionButton is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'KKFloatingActionButton', '~> 0.1.0'

Setup

Refer to the example project for more guidance.

  1. Add the import statement to your view controller.

    import KKFloatingActionButton
  2. Create a UIView(prefrably a perfect square) in IB and assign the custom class to KKFloatingMaterialButton, then connect it to an outlet in your view controller:

    @IBOutlet weak var menuButton: KKFloatingMaterialButton!

    (Note: This could be done programatically, I just prefer to use IB.)

  3. Conform to the KKFloatingMaterialButtonDataSource and KKFloatingMaterialButtonDelegate

    The control contains a customTableViewCell: (UINib, String) property that contains a UINib of the cell to be displayed in the menu, and a String which is the reuseIdentifier to be used for the cell. Set this property with your own custom UITableViewCell. The project does not use a deafult cell, you must provide a custom one. Refer to Example project.

  4. Create the custom UITableViewCell to be used in the menu. Be sure to call configureCellForKKFloatingActionButtonMenu() inside the cell’s awakeFromNib() method, otherwise the cells will appear upside down.

  5. Inside your view controllers viewDidLoad() call the configureViews() method on the KKFloatingMaterialButton BEFORE customizing.
    // Inside viewDidLoad()
    menuButton.configureViews() // Call this first 
    menuButton.dataSource = self
    menuButton.delegate = self
    // Continue customizing....

Customization

Here are some of the customization points of the control:

  • customTableViewCell: (UINib, String) – a tuple to hold a custom table view cell .xib and the reuse identifier associated with it. The must be set with your own custom UITableViewCell.
  • buttonShadowColor: UIColor? – The color of the button’s shadow.
  • buttonShadowOpacity: CGFloat? – The opacity of the button’s shadow. Kept between 0 and 1.
  • buttonBgColor: UIColor? – The background color of the button.
  • menuBgColor: UIColor? – The background color of the overlay that appears when the menu is presented.
  • menuBgOpacity: CGFloat – The opacity of the overlay that appears when the menu is presented.
  • rotatingImage: UIImage? – The image that rotates when the menu is presented. Displayed half the size of the button, aligned with the button’s center.
  • imageRotationAngle: CGFloat – The angle to rotate the rotatingImage when the menu is presented.
  • rippleColor: UIColor? – The color of the ripple animation that occurs when the button is toched.
  • ripplePercent: Float – How far the ripple animation when ripple outwards.
  • rippleLocation: MKRippleLocation – The start location of the ripple animation. Refer to MaterialKit documentation https://github.com/nghialv/MaterialKit.

License

KKFloatingActionButton is available under the MIT license. See the LICENSE file for more info.

Special Thanks to

Latest podspec

{
    "name": "KKFloatingActionButton",
    "platforms": {
        "ios": "8.0"
    },
    "summary": "RWPickFlavor lets a user select an ice cream flavor.",
    "requires_arc": true,
    "version": "0.0.7",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kyle Kirkland": "[email protected]"
    },
    "homepage": "https://github.com/kylelol/KKFloatingActionButton",
    "source": {
        "git": "https://github.com/kylelol/KKFloatingActionButton.git",
        "tag": "0.0.7"
    },
    "frameworks": [
        "UIKit",
        "QuartzCore"
    ],
    "dependencies": {
        "MaterialKit": []
    },
    "source_files": "KKFloatingActionButton/**/*.{swift}"
}

Pin It on Pinterest

Share This