AEAlertView
AEAlertView does not depend on any third-party library
Swift | range | use |
---|---|---|
version | 4.0 and below | Pod 'AEAlertView','1.0' |
version | 4.0-5.0 | Pod 'AEAlertView','1.7' |
version | 5.0+ | Pod 'AEAlertView' |
Please read the instructions before using it.
If you have any problems, please send emails or submit Issues at any time. Thank you very much.
It is recommended to download AlertViewDemo first, and check the specific usage method.
Version 2.3 is updated
2.3 Updates
Multiple lines of text can be used for buttons, pictures can be set, and pictures can be arranged left and right (Tips: If the height of the button is not set, it will be used uniformly according to the maximum height of the text)
The previous button attribute setting on alertView is abolished, please use `AEAlertAction` directly for button attribute.
Add 'public func create() {}' if you don't need to display on UIWindow you can call 'create()' after configuration to add alert to the view you need to add.
`AEAlertAction` currently only supports 2 display modes `defaulted, cancel`.
All setting properties are done in action. If you don't want to use cancel, you can set all action to defaulted.
v2.3.2- Support setting the maximum width
v2.3.4- Fix the problem that the title does not wrap lines by default. The number of Title lines can be set use.
v2.3.5- Fix if target init OS > 12, get window error
感谢大家反馈 如果你在使用中遇到任何问题、bug、建议等欢迎提交 点击进入讨论区
Thank you for your feedback. If you encounter any problems, bugs, suggestions, etc. in use, you are welcome to submit them discussions
Preview
2.3
2.2
other
[email protected] -
如果有 你有任何问题 或者 好的建议 欢迎联系我 - email:简单使用
func test() {
AEAlertView.show(title: "title", message: "fastest", actions: ["ok"]) { action in
print("dismiss----Fastest")
}
// set background image
AEAlertView.show(title: "title", message: "set background image", actions: ["cancel", "ok"], bgImage: UIImage(named: "006")) { action in
print("dismiss----background")
}
}
添加到自定义的view上
func test() {
let alert = AEAlertView.init(style: .defaulted, title: "title", message: "set gif height Add alert to the current view")
alert.setBackgroundImage(contentsOf: Bundle.main.path(forResource: "003", ofType: "gif"))
alert.backgroundImageHeight = 300
alert.messageColor = UIColor.red
let cancel = AEAlertAction.init(title: "cancel", style: .cancel) { (action) in
print("\(action.tag)")
alert.dismiss()
}
cancel.cancelTitleColor = .red
alert.addAction(action: cancel)
alert.create()
self.view.addSubview(alert)
}
自定义按钮主题
func test() {
let alert = AEAlertView(style: .defaulted, title: "custom action", message: "Please check the default values before using")
let cancel = AEAlertAction.init(title: "cancel\rcancel\rcancel", style: .cancel) { (action) in
alert.dismiss()
}
cancel.cancelTitleColor = UIColor.red
cancel.numberOfLines = 0
let dev = AEAlertAction.init(title: "dev", style: .defaulted) { (action) in
}
dev.image = UIImage(named: "index_def_icon")
// dev.imagePlacement = .right
alert.addAction(action: cancel)
alert.addAction(action: dev)
alert.show()
}
设置最大宽度
private func alertType3() {
let alert = AEAlertView.init(style: .defaulted, title: "title", message: "set gif height Add alert to the current view", maximumWidth: 600)
alert.setBackgroundImage(contentsOf: Bundle.main.path(forResource: "003", ofType: "gif"))
alert.backgroundImageHeight = 300
alert.messageColor = UIColor.red
let cancel = AEAlertAction.init(title: "cancel", style: .cancel) { (action) in
print("\(action.tag)")
alert.dismiss()
}
cancel.cancelTitleColor = .red
alert.addAction(action: cancel)
alert.create()
view.addSubview(alert)
}
*** 控件支持 设置左右 上下间距 本来想提供 类方法来一句话调用, 但是每个项目的主题色不同 所有需要你 自己设置自己的主题色***