Latest 1.0.0
Homepage https://github.com/Lawlietop/KYFloatingActionButton
License MIT
Platforms ios 8.0, requires ARC
Authors

That’s a FloatingActionButton and you can set its position with autolayout

Requirements

  • iOS 8.0+
  • Swift 3
  • Xcode 8+

Demo

KYFloatingActionButton

Usage

Step 1

Drag a UIView into storyboard or xib

Step 2

Give it constraint without width and height because it has a fixed width and height 55 ,Recommend adjusting height and width to 55 so that you could more easily set layout

Step 3

You can change the UIView bagroundcolor to adjust the FloatingActionButtonColor

Step 4

  • kinds of animation
    enum openButtonType {
        case slideUp
        case slideDown
        case popUp
        case popDown
    }
  • Demo Code

        button.kyDelegate = self
        button.openType = .popUp
        button.plusColor = UIColor.black     //  Change plus color
        button.fabTitleColor = UIColor.white    // Change title color
        button.add(color:UIColor.red)
        button.add(color:UIColor.orange)
        button.add(color: UIColor.brown, title: "Hello")
        button.add(color: UIColor.green, title: "Are you ready ?", image: UIImage(named: "Map Filled-50.png")!) { (item) in
            let alert = UIAlertController(title: "Hello", message: "Are you ok?", preferredStyle: .alert)
            let ok = UIAlertAction(title: "ok", style: .default, handler: nil)
            alert.addAction(ok)
            self.present(alert, animated: true, completion: nil)
        }

            // add a itemButton with closure 、 image 、 title and buttoncolor 

Step 5

  • You do something when button opening and closing with delegate (KYButtonDelegate) function , they are both optional function below

func openKYButton(_ button: KYButton) {

}

func closeKYButton(_ button: KYButton) {

}

Author

License

MIT,see License

Latest podspec

{
    "name": "KYFloatingActionButton",
    "version": "1.0.0",
    "summary": "Custom FloatingActionButton",
    "description": "Custom FloatingActionButton hope you like it",
    "homepage": "https://github.com/Lawlietop/KYFloatingActionButton",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Shane.Lin": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Lawlietop/KYFloatingActionButton.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "KYFloatingActionButton/Classes/**/*",
    "requires_arc": true,
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This