首页 > 技术文章 > [翻译] LiquidFloatingActionButton

YouXianMing 2015-09-17 20:17 原文

LiquidFloatingActionButton

 

https://github.com/yoavlt/LiquidFloatingActionButton

LiquidFloatingActionButton is floating action button component of material design in liquid state, inspired by Material In a Liquid State. This is also spinner loader components in liquid state.

LiquidFloatingActionButton是一个具有液体效果的浮动按钮组件,符合 material design 设计规范,灵感来自于 Material In a Liquid State 。你也可以将其用作加载信息。

Features

  •  liquid animation 液体流动动画效果
  •  easily custoizable 方便定制
  •  Objective-C compatible 兼容OC
  •  Swift2.0 支持Swift2.0

You can play a demo with appetize.io

你可以尝试一下demo

 

Usage

You just need implement LiquidFloatingActionButtonDataSource and LiquidFloatingActionButtonDelegate similar to well-known UIKit design.

你只需要实现 LiquidFloatingActionButtonDataSource 以及 LiquidFloatingActionButtonDelegate 即可。

let floatingActionButton = LiquidFloatingActionButton(frame: floatingFrame)
floatingActionButton.dataSource = self
floatingActionButton.delegate = self

 

LiquidFloatingActionButtonDataSource

  • func numberOfCells(liquidFloatingActionButton: LiquidFloatingActionButton) -> Int
  • func cellForIndex(index: Int) -> LiquidFloatingCell

 

LiquidFloatingActionButtonDelegate

  • optional func liquidFloatingActionButton(liquidFloatingActionButton: LiquidFloatingActionButton, didSelectItemAtIndex index: Int)

 

Easily customizable

 

Installation

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

你可以通过 CocoaPods 安装 LiquidFloatingActionButton。在Podfile中写入下面一句话即可:

pod "LiquidFloatingActionButton"

or, if you use Carthage, add the following line to your Carthage file.

或者,如果你在用 Carthage ,你在 Carthage 文件中写入一下一句话:

github "yoavlt/LiquidFloatingActionButton"

Please use swift-2.0 branch if you adopt latest Xcode.

如果想在最新的 Xcode 上使用,请用 swift-2.0。

 

License

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

 

推荐阅读