测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可 | MIT |
发布上次发布 | 2017年11月 |
SwiftSwift 版本 | 4.0 |
SPM支持 SPM | ✗ |
由 ripple_k 维护。
Swift 简单的 AlertView
要将 KAlertViewController 集成到项目中,首先确保您已安装 cocoaPods,然后执行
$pod init
配置podfile
文件
target 'TargetName' do
pod 'KAlertViewController'
end
配置完成后执行
$pod install
let alertView = KAlertView(title: "KAlertView", message: "Warmly celebrate the completion of KAlertView creation")
alertView.add(action: KalertAction(title: "取消", style: .cancel, handler: { (action) in
print(action.title)
}))
//MARK: - 注意循环引用
alertView.add(action: KalertAction(title: "确定", style: .destructive, handler: { [unowned alertView] (action) in
print(action.title)
for textField in alertView.textFields {
print(textField.text ?? "")
}
}))
alertView.addTextField { (textField) in
textField.placeholder = "请输入账号"
}
alertView.addTextField { (textField) in
textField.placeholder = "请输入密码"
}
let alertVC = KAlertController(alertView: alertView, preferredStyle: .alert)
alertVC.backgoundTapDismissEnable = true
present(alertVC, animated: true, completion: nil)