测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最后发布 | 2017年8月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 GCNotificationView 维护。
GCNotificationView
现在提供让您自定义以下功能。
GCNotificationView
是一个简单但非常有用的 iOS toast 消息视图。您可以使用一个方法轻松地设置消息并将它显示给用户。您可以将其位置设置为您想要的任何位置。
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
GCNotificationView
使用 Swift 3 编写。兼容 iOS 8.0 以上。
GCNotificationView
可通过 CocoaPods 获得。要安装它,只需将以下行添加到您的 Podfile
pod "GCNotificationView"
首先需要导入 GCNotificationView
import GCNotificationView
然后使用 GCNotificationView
所需做的就是简单调用包含您消息的方法。
GCNotificationView().show(message: "Hello, World!")
或者您可以使用自己的喜好定制 toast 视图。
// Customize notification view on initialize
var notificationView = GCNotificationView()
notificationView.duration = 0.3
notificationView.delay = 3.0
notificationView.yPoint = 0.0
notificationView.bgColor = .orange
notificationView.textColor = .white
notificationView.show(message: "Hello, World!")
// Customize notification view on show
GCNotificationView()
.change(duration: 0.3)
.change(delay: 3.0)
.change(yPoint: 0.0)
.change(bgColor: .orange)
.change(textColor: .white)
.show(message: "Hello, World!")
完成了!非常简单和简单。
您可以自定义这些变量。如果您没有提及这些变量,则将自动设置为默认值。
var duration: Double // Time in second for toast to animating (Default is 0.3)
var delay: Double // Time in second for toast to present (Default is 3.0)
var yPoint: CGFloat // Position of the toast view on y-axis (Default is 0)
var bgColor: UIColor // Background color of toast view (Default is light blue)
var textColor: UIColor // Message color of toast (Default is white)
// Supports various initialization
GCNotificationView()
GCNotificationView(duration: 0.3, yPoint: 0)
GCNotificationView(delay: 3.0, yPoint: 0)
GCNotificationView(duration: 0.3, delay: 3.0, yPoint: 0)
Junho, [email protected]
GCNotificationView 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。