FUIOfflineBannerMessageView
@MainActor
public class FUIOfflineBannerMessageView : FUIBannerMessageView
FUIOfflineBannerMessageView shows an overlay message centered in the screen underneath a navigation bar. FUIOfflineBannerMessageView must be attached to a FUINavigationBar to make it work properly.
FUIOfflineBannerMessageView is a subclass of FUIBannerMessageView and FUINavigationBar can contain only one FUIBannerMessageView.
Call show() on a FUIOfflineBannerMessageView instance to show the message. By default, the message is shown centered on screen for four seconds.
Usage
Usually, the creation of FUIOfflineBannerMessageView and attachment to FUINavigationBar is
in the viewDidAppear function of a UIViewController. As the code indicates below:
override public func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
guard let navBar = self.navigationController?.navigationBar as? FUINavigationBar else {
return
}
let offlineBannerView = FUIOfflineBannerMessageView()
navBar.bannerView = offlineBannerView
offlineBannerView.show(message: "200k pending to upload example with text showing wrapping to two lines")
self.offlineBanner = offlineBannerView
}
Theming
fdlFUIOfflineBannerMessageView_titleLabel {
font-size: 13;
font-name: mediumSystem;
font-color: @primary7;
font-color-highlighted: @tintColorDark;
}
fdlFUIOfflineBannerMessageView_dividerBottom {
background-color: @line;
}
-
Show the banner with a message under navigation bar for a certain duration.
Declaration
Swift
@MainActor override open func show(message: String, withDuration duration: TimeInterval = 4, animated: Bool = true)Parameters
messageThe message which will show on the banner.
durationThe duration in seconds for which the toast message is shown. The default is
4.animatedWhether the banner is shown with an animation. The default is
true.