Skip to content

ripplek/KAlertViewController

Repository files navigation

KAlertViewController

Swift简单的AlertView

apm

Features

功能浏览

Requirements

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

Installation with CocoaPods

通过cocoaPods将KAlertViewController集成到你的项目中,首先要确保你已经安装了cocoaPods,然后执行 $pod init 配置podfile文件

target 'TargetName' do
pod 'KAlertViewController'
end

配置完成后执行 $pod install

usage

        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)

About

自定义弹框视图

Resources

License

Stars

Watchers

Forks

Packages

No packages published