LPSnackbar
特性
安装
Cocoapods (推荐)
-
安装 CocoaPods。
-
将此 pod 添加到您的
Podfile
中。target 'Example' do use_frameworks! pod 'LPSnackbar' end
-
运行
pod install
。 -
打开 CocoaPods 创建的
.xcworkspace
。 -
将
LPSnackbar
导入需要它的任何源文件。
从源导入
- 从这里下载源代码,并将其添加到您的Xcode项目中。
用法
提示可以是简单的
// Yes, this simple.
LPSnackbar.showSnack(title: "I'm a snack!")
提示可以自定义
let snack = LPSnackbar(title: "Object deleted.", buttonTitle: "UNDO")
// Customize the snack
snack.bottomSpacing = (tabBarController?.tabBar.frame.height ?? 0) + 15
snack.view.titleLabel.font = UIFont.systemFont(ofSize: 20)
// Show a snack to allow user to undo deletion
snack.show(animated: true) { (undone) in
if undone {
// Undo deletion
} else {
// Follow through with deletion
}
}
示例
下载并运行示例项目
文档
完整文档可在此处查看 (链接)