要运行示例项目,请clone仓库,然后首先从示例目录运行pod install
。
RADInfoBannerView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "RADInfoBannerView"
导入模块
import RADInfoBannerView
显示带有“Hello”文本的简单信息banner视图
RADInfoBannerView.showInfoBannerView("Hello")
带有 Activity Indicator 和隐藏延迟
RADInfoBannerView.showInfoBannerView("Loading more messages", showActivityIndicatorView: true, hideAfter: 5.0)
自定义信息banner视图
let infoBannerView = RADInfoBannerView(text: text, showActivityIndicatorView: self.activityIndicatorSwitch.on)
infoBannerView.backgroundColor = .redColor()
infoBannerView.textLabel.textColor = .yellowColor()
infoBannerView.show().hide(afterDelay: 3.0)
注意:如果您正在使用 UIViewController Containment,您需要指定要显示信息banner视图的控制器
RADInfoBannerView.showInfoBannerView("Loading more messages", showActivityIndicatorView: true, inController: self)
最后,隐藏
RADInfoBannerView.hideAllInfoBannerView(inController: self, animated: true)
RADInfoBannerView 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。