C2Alert
关于
C2Alert 是一个简单且设计精美的可定制警报库。
带图标
需求
安装
C2Alert 通过 CocoaPods 提供。要安装它,只需在您的 Podfile 中添加以下行:
pod 'C2Alert'
支持的 Swift 版本
C2Alert 版本 | Swift 版本 | 最低 iOS 版本 |
---|---|---|
=> 0.1.0 | Swift 3 | >= iOS 9.0 |
开始使用
使用合适的初始化器创建一个C2Alert对象,然后调用show方法
使用方法
基本
let alert = C2Alert(title: "Success", message: "You're doing great!", image: UIImage(named: "success_icon")!)
alert.show()
可用的修饰符
let alert = C2Alert(title: "Success", message: "You're doing great!", image: UIImage(named: "success_icon")!)
alert.autoHideAfterSeconds = 5
alert.dialogBackgroundColor = .gray
alert.dialogImageColor = .black
alert.dialogMessageTextColor = .black
alert.dialogTitleTextColor = .black
alert.duration = 0.6 // This is show and hide animate duration
alert.hideOnBackgroundTouch = false // default true
alert.imageSize = CGSize(width: 100, height: 100)
alert.messageFont = UIFont(name: "Avenir-Roman", size: 15)!
alert.titleFont = UIFont(name: "Avenir-Heavy", size: 18)!
alert.overlay = true // default true
alert.overlayColor = .black // default black
alert.overlayOpacity = 0.3 // default 0.6
alert.paddingFromSides = 30 // default 32
alert.seperatorHeight = 8 // Space between title, message and image
alert.paddingTopAndBottom = 22 // default 24
alert.show()
需求
- iOS 9.0+
- Xcode 8.0+
- Swift 3.0+
作者
许可证
C2Alert 使用 MIT 许可证。有关更多信息,请参阅 LICENSE 文件。