HNToaster
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
。
屏幕截图
安装
HNToaster 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile
pod 'HNToaster'
使用方法
首先,在 Swift 文件中导入 HNToaster。
import HNToaster
简单用法
Toast弹窗在视图中央显示。
let message1: String = "Can you see me?"
Toaster.toast(onView: self.view, message: message1)
可用选项
您可以通过frame
参数设置Toast的位置和区域。
同时也可以通过font
参数设置字体样式和大小。
let message2: String = """
You can arrange
the toast's frame
and the message's font.
"""
let toastFrame: CGRect = CGRect(x: 10, y: self.view.bounds.height - 150, width: self.view.bounds.width - 20, height: 120)
let messageFont: UIFont = UIFont.italicSystemFont(ofSize: 32)
Toaster.toast(onView: self.view, message: message2, frame: toastFrame, font: messageFont)
作者
hahnah, https://superhahnah.com/
许可协议
HNToaster遵循MIT许可协议。更多信息请参阅LICENSE文件。