Swift 运用AlertViewTool简单使用(及第三方SCLAlertView用法)

废话不多说,直接上干货

import Foundation

class AlertViewTool: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    override func viewDidAppear(_ animated: Bool){
        super.viewDidAppear(animated)
         
        let alertController = UIAlertController(title: "你确定要注销吗",
                        message: "注销后账号会被清空,你确定?", preferredStyle: .alert)
        let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: nil)
        let okAction = UIAlertAction(title: "确定", style: .default, handler: {
            action in
            print("点击了确定")
        })
        
        alertController.addAction(cancelAction)
        alertController.addAction(okAction)
        self.present(alertController, animated: true, completion: nil)
    }
     
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
}

// 第三方SCLAlertView 自定义提示框样式

        let  appearance =  SCLAlertView . SCLAppearance (
            showCircularIcon:  false   //隐藏头部图标
        )
        SCLAlertView (appearance: appearance).showTitle( "收不到验证码?" , subTitle:
                                                            "如果没有收到验证码,建议您进行以下操作:\n请检查你的手机号码是否填写正确络;   \n请检查你的手机号码是否停机或者无网络;\n请检查你的手机号码短信是否被屏蔽。" ,
                                                         timeout:  nil , completeText:  "确认" , style: .success,
                                                         colorStyle:0xFFFFFF, colorTextButton: 0xFF7199EA,
                                                         circleIconImage:  UIImage (named:  "" ),
                                                         animationStyle: .noAnimation)

你可能感兴趣的:(Swift 运用AlertViewTool简单使用(及第三方SCLAlertView用法))