Hokusai 0.4.0

Hokusai 0.4.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2017年6月
SwiftSwift版本3.0+
SPM支持SPM

ytakzk维护。



Hokusai 0.4.0

  • ytakzk

Hokusai是一个提供弹跳动作表的Swift库。
它将为用户带来炫酷的体验,而不必在编写酷炫动画时费尽心思。
Hokusai与Swift2.2兼容!!

安装

将类文件夹添加到您的Xcode项目中。
您也可以使用cocoapods或Carthage。

演示

Demo

Hokusai用法

导入Hokusai import Hokusai然后使用以下代码在viewDidLoad之外的某些函数中。

let hokusai = Hokusai()

// Add a button with a closure
hokusai.addButton("Button 1") {
    println("Rikyu")
}

// Add a button with a selector
hokusai.addButton("Button 2", target: self, selector: Selector("button2Pressed"))

// Set a font name. AvenirNext-DemiBold is the default. (Optional)
hokusai.fontName = "Verdana-Bold"

// Select a color scheme. Just below you can see the dafault sets of schemes. (Optional)
hokusai.colorScheme = HOKColorScheme.Enshu

// Show Hokusai
hokusai.show()

// Selector for button 2
func button2Pressed() {
    println("Oribe")
}

// Change a title for cancel button. Default is Cancel. (Optional)
hokusai.cancelButtonTitle = "Done"

// Add a callback for cancel button (Optional)
hokusai.cancelButtonAction = {
    println("canceled")
}

添加标题和消息

// Init with title
let hokusai = Hokusai(headline: "Information")

// Init with title and message
let hokusai = Hokusai(headline: "Information", message: "This can be a long multi-lined message.")

// ...or add title and message later, but before you call `show()`
hokusai.headline = "Infomration"
hokusai.message  = "This can be a long multi-lined message."

添加一个带有闭包的按钮

hokusai.addButton("Button Title") {
    // Do anything you want
}

添加一个带有选择器的按钮

hokusai.addButton("Button Title", target: self, selector: Selector("buttonPressed"))

func buttonPressed() {
    // Do anything you want
}

颜色方案

Demo

public enum HOKColorScheme {
    case  Hokusai,
          Asagi,
          Matcha,
          Tsubaki,
          Inari,
          Karasu,
          Enshu
}

或者,您可以使用您喜欢的颜色组合。

hokusai.colors = HOKColors(
    backGroundColor: UIColor.blackColor(),
    buttonColor: UIColor.purpleColor(),
    cancelButtonColor: UIColor.grayColor(),
    fontColor: UIColor.whiteColor()
)

作者

ytakzk
http://ytakzk.me

许可证

Hokusai在MIT许可证下发布。
查看LICENSE以获取详细信息。