MIFab 1.0

MIFab 1.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2016年10月
SPM支持 SPM

Mario Iannotta 维护。



MIFab 1.0

  • Mario Iannotta

MIFab

一款带有选项的简单可完全自定义的浮动操作按钮

设置

  • 将“MIFab”文件夹复制到您的项目中。
  • 通过几行代码创建一个新的实例
  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)

        }
      )
    ]
)
  • 您可以使用以下方法显示或隐藏 fab
showButton(animated: Bool = false)
hideButton(animated: Bool = false)
  • 通过更改配置属性您可以自定义 UI

演示

在此存储库中您还可以找到演示。

信息

如果您喜欢这个 git,可以在以下位置关注我或推特 :) @MarioIannotta

来自意大利的问候!