QXMessageView
Swift 中容易定制的提示板。
install
pod search QXMessageView
simple use
extension UIViewController {
func showLoading(msg: String?) {
_ = QXMessageView.demoLoading(msg: msg, superview: view)
}
func hideLoading() {
for view in view.subviews {
if let view = view as? QXMessageView {
view.remove()
}
}
}
func showSuccess(msg: String, complete: (() -> ())? = nil) {
QXMessageView.demoSuccess(msg: msg, superview: view, complete: complete)
}
func showFailure(msg: String, complete: (() -> ())? = nil) {
QXMessageView.demoFailure(msg: msg, superview: view, complete: complete)
}
func showWarning(msg: String, complete: (() -> ())? = nil) {
QXMessageView.demoWarning(msg: msg, superview: view, complete: complete)
}
}
customize
对于定制提示板,只需要像演示那样实现。
class DemoView: QXMessageViewContentViewProtocol {
// Customize view follow QXMessageViewContentViewProtocol
}
let demoView = DemoView()
let messageView = QXMessageView.messageView(contentView: demoView, superview: self, duration: 1, complete: {
// todo
})
祝您玩得开心!