GithubHelp home page GithubHelp logo

uetcis / mifab Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carabina/mifab

0.0 3.0 0.0 1.41 MB

A simple fully customizable floating action button with options

License: MIT License

Ruby 3.63% Swift 96.37%

mifab's Introduction

MIFab

A simple fully customizable floating action button with options

Platform Swift 3.0 Cocoapods Compatible

Setup

  • Add pod 'MIFab', '~> 1.1' to your Podfile or copy the "MIFab" folder to your project.
  • Create a new instance with a couple of lines of code
  var fabConfig = MIFab.Config()
        
  fabConfig.buttonImage = UIImage(named: "iconC")
  fabConfig.buttonBackgroundColor = UIColor.orange
        
  fab = MIFab(
    parentVC: self,
    config: fabConfig,
    options: [
      MIFabOption(
        title: "Item 2",
        image: UIImage(named: "iconB"),
        backgroundColor: UIColor.orange,
        tintColor: UIColor.white,
        actionClosure: {
                        
          let alertController = UIAlertController(title: "Demo", message: "Second fab button tapped", preferredStyle: .alert)
          alertController.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
                        
          self.present(alertController, animated: true, completion: nil)
                        
        }
      ),
      MIFabOption(
        title: "Item 1",
        image: UIImage(named: "iconA"),
        backgroundColor: UIColor.orange,
        tintColor: UIColor.white,
        actionClosure: {
                        
          let alertController = UIAlertController(title: "Demo", message: "First fab button tapped", preferredStyle: .alert)
          alertController.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
                        
          self.present(alertController, animated: true, completion: nil)
                        
        }
      )
    ]
)
  • You can show or hide the fab with the methods
showButton(animated: Bool = false)
hideButton(animated: Bool = false)
  • You can customize the UI by changing the config properties

Demo

In this repository you can also find a demo.

Info

If you like this git you can follow me here or on twitter :) @MarioIannotta

Cheers from Italy!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.