Alert
[](https://travis-ci.org/Stan Liu/Alert)
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
请注意示例中的 storyboard 使用了 UIStackView,因此它只能在 iOS 9.0 或更高版本的设备及模拟器上运行。但 Alert 使用 Swift 3.0,可以在 iOS 8 或更高版本的设备及模拟器上运行。
需求
安装
警报通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'Alert', :git => 'https://github.com/lyc2345/alert.git'
用法
Import Alert
将按钮添加到 UIAlertController
Alert.with(title: "Title", message: "Message", style: .alert).bind(button: "Button", style:
.default, completion: {
(action1) in
)}
然后向 UIAlertController 添加 Textfield
Alert.with(title: "Title", message: "Message", style: .alert).bind(button: "Button", style:
.default, completion: {
(action1) in
)}.bind(textfield: "Title", placeHolder: "PlaceHolder", secure: false, returnHandler: {
(textfield1) in
})
然后呈现此 UIAlertController
Alert.with(title: "Title", message: "Message", style: .alert).bind(button: "Button", style:
.default, completion: {
(action1) in
)}.bind(textfield: "Title", placeHolder: "PlaceHolder", secure: false, returnHandler: {
(textfield1) in
}).show()
作者
Stan Liu, [email protected]
许可证
警报受 MIT 许可证的许可。有关更多信息,请参阅 LICENSE 文件。