BHToast可以通过CocoaPods获得。要安装它,只需将以下行添加到你的Podfile
pod "BHToast"BHToast(view: view, message: "This is an example message.").show()或
let toast = BHToast(view: view)
toast.message = "This is an example message."
toast.show()BHToast(view: view, message: "This is an example message.", imageView: `yourImageView`).show()或
let toast = BHToast(view: view, message: "This is an example message.")
toast.imageView = `yourImageView`
toast.show()import BHToast
let options = BHToastOptions(
duration: 10.0,
borderWidth: 0.0,
cornerRadius: 0.0
)
BHToast(view: view, message: "This is an example message.", options: options).show()BHToastViewTag用于确保视图中只有一个实例。如果需要,在第一个BHToast实例之前更改它。
你可以使用以下属性创建一个BHToastOptions实例
BHToast停留在UIView中的时间。 默认:5.0duration: NSTimeIntervalanimationDuration: NSTimeIntervalbackgroundColor: UIColorborderColor: UIColorborderWidth: CGFloatcornerRadius: CGFloatbottomOffset: CGFloatcontentInsets: UIEdgeInsetsminHeight: CGFloatmaxHeight: CGFloatmessageAlignment: NSTextAlignmentmessageColor: UIColormessageFont: UIFontimagePosition: BHToastImagePosition所有这些属性都有一个默认值。将它们更改以将自定义应用到所有新的BHToast实例。
Bruno Hecktheuer, [email protected]
BHToast遵循MIT许可协议。有关更多信息,请参阅LICENSE文件。