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)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容