KAlertViewController 1.0.0

KAlertViewController 1.0.0

测试已测试
语言语言 SwiftSwift
许可 MIT
发布上次发布2017年11月
SwiftSwift 版本4.0
SPM支持 SPM

ripple_k 维护。



  • 张坤

KAlertViewController

Swift 简单的 AlertView

apm

特性

功能浏览

要求

  • iOS9.0+
  • Xcode9.0+
  • Swift4.0+

通过 CocoaPods 安装

要将 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)