AlertUI
示例
要运行示例项目,请克隆仓库,然后首先从Example目录运行 pod install
特性
- 易于自定义:更改颜色、图标等
- 添加图片
- 添加标题
- 添加消息
- 添加图标
- 添加您想要的按钮动作
- 3种不同的警报视图
- swift 5
要求
- iOS 13 或更高版本
- Xcode 11 或更高版本
截图
安装
AlertUI 可通过 CocoaPods 使用。要安装它,只需将以下行添加到您的 Podfile 中
pod 'AlertUI'
import AlertUI
功能
AlertAction
init(buttonAction:[String: () -> Void], buttonColor: UIColor, imageName:String? ,imageColor:UIColor? )
示例
let buttonAction : [String: () -> Void] = [ "button title": {
print("tapped")
}]
let arrayActions = [
AlertAction(buttonAction: buttonAction, buttonColor: UIColor.black, imageName: "follow", imageColor: UIColor.black)
]
显示警报
func showAlertControllerOptions(
icons: UIImage?,
title: String?,
titleColor: UIColor?,
messageColor: UIColor?,
message:String?,
backgroundColor:UIColor?,
lineColor: UIColor?,
DismissTitle: String?,
DismissColor: UIColor?,
DismissTitleColor: UIColor?,
actions: [AlertAction]?)
AlertActionButtons
init(
buttonAction:[String: () -> Void],
titleColor:UIColor,
backgroundColor:UIColor?,
borderColor:UIColor?,
borderWidth:CGFloat?
)
示例
let Follow : [String: () -> Void] = [ "Follow": {
print("tapped Follow")
}]
let arrayActions = [
AlertActionButtons(buttonAction: Follow, titleColor: UIColor.white, backgroundColor: UIColor.red, borderColor: nil, borderWidth: nil),
]
显示警报
func ShowAlertControllerButtons(icons: UIImage?,
title: String?,
titleColor: UIColor?,
messageColor: UIColor?,
message:String?,
backgroundColor:UIColor?,
lineColor: UIColor?,
DismissTitle: String?,
DismissColor: UIColor?,
DismissTitleColor: UIColor?,
actions: [AlertActionButtons]?)
仅使用消息和图像显示警报
func showAlert(
icons: UIImage?,
title: String?,
titleColor: UIColor?,
messageColor: UIColor?,
message:String?,
backgroundColor:UIColor?,
DismissTitle: String?,
DismissColor: UIColor?,
DismissTitleColor: UIColor?)
作者
Faris Albalawi, [email protected]
许可证
AlertUI采用MIT许可证提供。详细信息请参阅LICENSE文件。