EAAlertView
风格为iOS 11的警告框
警告框 & 选择器
包含文本框、文本视图、日期选择器、选择器的警告框
使用方法
- 创建新警告框
let alert = EAAlertView(appearance: appearance)
// or
let alert = EAAlertView()
- 设置和风格信息
let appearance = EAAlertView.EAAppearance(
kTextFieldHeight: 60,
kButtonHeight: 60,
showCloseButton: false,
shouldAutoDismiss: false
)
- 添加带图片的按钮
alert.addAction(image: image, title: "Title", color: .black, style: .default) { action in
// completion handler
}
- 显示警告框
// show alert
_ = alert.show("Title", subTitle: "subtitle")
日期选择器
let picker = UIDatePicker(frame: CGRect(x: 0, y: 0, width: self.view.frame.width*0.8, height: 200))
picker.datePickerMode = UIDatePickerMode.date
let appearance = EAAlertView.EAAppearance(kButtonHeight: 60, showCloseButton: false, shouldAutoDismiss: false)
let alert = EAAlertView(appearance: appearance)
alert.customSubview = picker
_ = alert.addButton(backgroundImage: image), "Select") {
alert.dismiss(animated: true, completion: .none)
}
_ = alert.show("Birthdate", subTitle: " ")
文本视图
let appearance = EAAlertView.EAAppearance(kTextViewdHeight: self.view.frame.height*0.6, kButtonHeight: 60, showCloseButton: false, shouldAutoDismiss: false)
let alert = EAAlertView(appearance: appearance)
let textView = alert.addTextView()
textView.text = "text"
_ = alert.addButton(backgroundImage: image, "Accept") {
alert.dismiss(animated: true, completion: .none)
}
_ = alert.show("Terms", subTitle: "")
安装过程
Cocoapods
pod 'EAAlertView'
需求
- Swift 4
- iOS 11 或更高版本
作者
- Egzon Arifi - egzonarifi
沟通
- 如果您发现了一个错误,请打开一个issue。
- 如果您有一个功能请求,请打开一个issue。
- 如果您想贡献,提交一个pull request。
许可证
本项目遵循MIT许可证。