GTAlertCollection
关于
GTAlertCollection 是一个 Swift 组件,它能够在调用单个方法时轻松地 显示警报。
GTAlertCollection 基于类 UIAlertController
实现了警报控制器。它支持和提供多种警报类型
将 GTAlertCollection 集成到您的项目中
有两种方法可以将 GTAlertCollection 集成到您的项目中。
使用 CocoaPods
在 Podfile 中添加以下内容
pod 'GTAlertCollection'
然后在项目中任何一个您想使用 GTAlertCollection 的地方导入 GTAlertCollection
import GTAlertCollection
手动集成
克隆或下载仓库,并将文件 GTAlertCollection.swift 从 GTAlertCollection/Source 文件夹添加到项目中。
概览
GTAlertCollection
提供以下公开方法:
presentSingleButtonAlert(withTitle:message:buttonTitle:actionHandler:)
presentAlert(withTitle:message:buttonTitles:cancelButtonIndex:destructiveButtonIndices:actionHandler:)
presentButtonlessAlert(withTitle:message:presentationCompletion:)
presentActivityAlert(withTitle:message:activityIndicatorColor:showLargeIndicator:presentationCompletion:)
presentProgressBarAlert(withTitle:message:progressTintColor:trackTintColor:showPercentage:showStepsCount:updateHandler:presentationCompletion:)
presentSingleTextFieldAlert(withTitle:message:doneButtonTitle:cancelButtonTitle:configurationHandler:completionHandler:)
presentMultipleTextFieldsAlert(withTitle:message:doneButtonTitle:cancelButtonTitle:numberOfTextFields:configurationHandler:completionHandler:)
presentImageViewAlert(withTitle:message:buttonTitles:cancelButtonIndex:destructiveButtonIndices:image:actionHandler:)
dismissAlert(completion:)
此外,以下属性也可用:
alertController
:展示的提醒控制台。hostViewController
:提醒控制台展示到的视图控制器。activityIndicator
:提醒的活动指示器。progressBar
:显示进度条的UIProgressView
对象。label
:进度条下方的标签。imageView
:提醒的图像视图。
请阅读 wiki 了解如何使用 GTAlertCollection
以及各种提醒类型。您还可以找到由 jazzy 导出的 文档。
注意
各种提醒控制台的实现以及 GTAlertCollection
类的创建是个人作品,不是 网上找到的提醒的收集。