EZAlertController 3.2

EZAlertController 3.2

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

Furkan Yilmaz 维护。



  • 作者:
  • thellimist

EZAlertController

简单的 Swift UIAlertController

  • 所有 UIAlertView 的单行配置
  • 使用闭包代替选择器进行按钮操作
  • 轻松自定义
  • 简单的操作表

Swift 2.0 在 这个分支 上维护

用法

单按钮警告

EZAlertController.alert("Title")
EZAlertController.alert("Title", message: "Message")
EZAlertController.alert("Title", message: "Message", acceptMessage: "OK") { () -> () in
    print("cliked OK")
}

EZAlertController

多按钮警告

EZAlertController.alert("Title", message: "Message", buttons: ["First", "Second"]) { (alertAction, position) -> Void in
    if position == 0 {
        print("First button clicked")
    } else if position == 1 {
        print("Second button clicked")
    }
}

EZAlertController

操作表

// With individual UIAlertAction objects
let firstButtonAction = UIAlertAction(title: "First Button", style: UIAlertActionStyle.Default, handler: { (UIAlertAction) -> Void in
    print("First Button pressed")
})
let secondButtonAction = UIAlertAction(title: "Second Button", style: UIAlertActionStyle.Default, handler: { (UIAlertAction) -> Void in
    print("Second Button pressed")
})

EZAlertController.actionSheet("Title", message: "message", actions: [firstButtonAction, secondButtonAction])

// With all actions in single closure
EZAlertController.actionSheet("Title", message: "Message", buttons: ["First", "Second"]) { (alertAction, position) -> Void in
    if position == 0 {
        print("First button clicked")
    } else if position == 1 {
        print("Second button clicked")
    }
}

EZAlertController

可自定义的

let alertController = EZAlertController.alert("Title") // Returns UIAlertController
alertController.setValue(attributedTitle, forKey: "attributedTitle")
alertController.setValue(attributedMessage, forKey: "attributedMessage")
alertController.view.tintColor =  self.view.tintColor
...

要求

  • Swift 版本 3.0

安装

手动安装

  • 下载 'EZAlertController.swift'并在您的项目中将其拖放。

改进

  • 欢迎发送拉取请求。

许可证

  • EZAlertController 在 MIT 许可证下可用。参见LICENSE 文件

关键字

swift, alert, AlertView, AlertViewController, UIAlertView, UIAlertViewController