FDAlertPopup
FineDine Alert ViewController,用 Swift 编写。
需求
- iOS 9.0+
- Swift 5+
显示类型
确认 | 对话框 | 信息 |
---|---|---|
![]() |
![]() |
![]() |
安装
CocoaPods 是 Cocoa 项目的依赖管理器。您可以使用以下命令来安装它
$ gem install cocoapods
要使用 CocoaPods 在您的 Xcode 项目中集成 SwiftEntryKit,请将其指定在您的 Podfile
中
source 'https://github.com/cocoapods/specs.git'
platform :ios, '9.0'
use_frameworks!
pod 'FDAlertPopup'
然后,运行以下命令
$ pod install
快速使用
let popup = FDAlertPopup()
/*
Do some customization on popup
*/
popup.titleText = "Title"
popup.bodyText = "Body"
popup.noteText = "Note"
popup.display()
资源
您可以显示包含图像或lottie资源的弹出窗口。
图像资源
let popup = FDAlertPopup()
/*
You can use default success, fail and info resources.
Or with calling .custom("RESOURCE_NAME") you can use your custom images.
*/
popup.iconResource = .success
popup.display()
Lottie资源
如果您在设置Lottie资源之前设置了图像资源,Lottie资源将覆盖图像资源,弹出窗口将仅显示Lottie资源。
let popup = FDAlertPopup()
/*
You can use default success, fail, info and wait resources.
Or with calling .custom("RESOURCE_NAME") you can use your custom lottie files.
*/
popup.lottieResource = .success
popup.display()
支持的属性
属性 | 描述 | 默认值 |
---|---|---|
lottieResource | 动画的lottie资源 | nil |
iconResource | 图标的图像资源 | nil |
titleLabelFont | 标题标签的字体 | UIFont(name: "NunitoSans-SemiBold", size: 24) |
bodyLabelFont | 主体标签的字体 | UIFont(name: "NunitoSans-Regular", size: 20) |
noteLabelFont | 备注标签的字体 | UIFont(name: "NunitoSans-Italic", size: 20) |
buttonsFont | 按钮标签的字体 | UIFont(name: "NunitoSans-Italic", size: 18) |
titleLabelColor | 标题标签的文本颜色 | UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1) |
bodyLabelColor | 主体标签的文本颜色 | UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1) |
noteLabelColor | 备注标签的文本颜色 | UIColor(red: 0.2, green: 0.2, blue: 0.2, alpha: 1) |
titleText | 将作为标题标签显示的文本 | "" |
bodyText | 将作为主体标签显示的文本 | "" |
noteText | 将作为备注标签显示的文本 | "" |
confirmButtonText | 将在确认按钮上显示的文本 | "" |
confirmButtonTitleColor | 确认按钮标题的文本颜色 | UIColor.white |
confirmButtonBgColor | 确认按钮的背景颜色 | UIColor(red: 0.9, green: 0.01, blue: 0.29, alpha: 1) |
confirmButtonBorderColor | 确认按钮的边框颜色 | UIColor.clear |
cancelButtonText | 文本将显示在“取消”按钮上 | "" |
cancelButtonTitleColor | “取消”按钮标题的文本颜色 | UIColor(red: 0.42, green: 0.42, blue: 0.42, alpha: 1) |
cancelButtonBgColor | “取消”按钮的背景颜色 | UIColor.clear |
cancelButtonBorderColor | “取消”按钮的边框颜色 | UIColor(red: 0.42, green: 0.42, blue: 0.42, alpha: 1) |
鸣谢
使用SnapKit项目来创建自动布局约束。
使用LGButton项目来创建可定制的按钮。
使用Lottie项目来显示平滑动画。