AMZAlertController
简介
AMZAlertController 是一个简单、现代的警告控制器,它比 UIAlertController 更好,但与之相似。
示例
要运行示例项目,请先克隆仓库,然后从 Example 目录运行 pod install
要求
iOS 11.0+
安装
AMZAlertController 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'AMZAlertController'
使用方法
基本警报
let alertController = AMZAlertController.alertControllerWithTitle("Hello, World!", message: "This Is An Alert Controller!")
let alertAction = AMZAlertAction(withTitle: "Dismiss", style: .filled, handler: nil)
alertController.addAction(alertAction)
present(alertController, animated: true, completion: nil)
添加多个操作
let okAction = AlertAction(withTitle: "OK", style: .filled, handler: nil)
let maybeAction = AlertAction(withTitle: "Maybe", style: .hollow, handler: nil)
let dismissAction = AlertAction(withTitle: "Dismiss", style: .default, handler: nil)
alertController.addActions([okAction, maybeAction, dismissAction])
实现操作处理器
let handlerAlertAction = AlertAction(withTitle: "Do Something", style: .filled, handler: { (alertAction) in
print("Button was clicked!")
})
背景样式
.transparent: Displays a transparent background over the presenting view controller (default)
.clear: Displays a clear background over the presenting view controller.
.blurred: Displays a blurred background over the presenting view controller.
操作样式
.default: Displays a text based button (default)
.filled: Displays a color filled button.
.hollow: Displays a text based button with a border for a hollow look.
作者
Appmazo LLC, [email protected]
许可证
AMZAlertController 遵循 MIT 许可协议。更多详细信息请参阅 LICENSE 文件。