iOS-YHAlertView(自定义AlertView,Swift版)

github:YHAlertView

简单介绍

YHAlertView是仿系统的UIAlertView,UIAlertController弹出风格而定制的弹出视图。支持多选择,模糊背景,通俗易懂,扩展性好,代码无侵入。由此,你可以定制专属风格的AlertView.

API 介绍

在YHAlertView.swift文件中,用标注的方式Public Property,Public Method,Private Property,Private Method区分好公有和私有的属性、方法。

调用方式

可以参考我的DEMO.:YHAlertView

// 样式一:
// message 和 cancelBtn 为nil
                YHAlertView.show(title: "YHAlertView", message: nil, cancelButtonTitle: nil, otherButtonTitle: "确定") { (alertV:YHAlertView, index:Int) in
                    print("点击下标是:\(index)")
                }

// 样式二:
// message 好长
                YHAlertView.show(title: "YHAlertView", message: "消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊啊消息好长啊啊", cancelButtonTitle: "取消", otherButtonTitle: "确定") { (alertV:YHAlertView, index:Int) in
                    print("点击下标是:\(index)")
                }

// 样式三
// 多选择弹框
                YHAlertView.show(title: "YHAlertView", message: "多选择弹框", cancelButtonTitle: "取消", otherButtonTitles:"1","2","3","4","5","6") { (alertV:YHAlertView, index:Int) in
                    print("点击下标是:\(index)")
                }


// 样式四
// 取消模糊背景
                let alertV = YHAlertView(title: "YHAlertView", message: "取消模糊背景", delegate: self, cancelButtonTitle: "取消", otherButtonTitles: ["确定"])
                alertV.visual = false
                alertV.show()

// 样式五
// 取消弹出动画,改变背景颜色
            let alertV = YHAlertView(title: "YHAlertView", message: "取消弹出动画,改变背景颜色", delegate: self, cancelButtonTitle: "取消", otherButtonTitles: ["确定"])
            alertV.visual = false
            alertV.animationOption = .none
            alertV.visualBGColor = UIColor.red
            alertV.show()

效果图

还在路上,稍等... 还在路上,稍等... 还在路上,稍等... 还在路上,稍等... 还在路上,稍等... 还在路上,稍等...

点赞的都是帅哥和美女!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值