FUIBannerMessageView
open class FUIBannerMessageView: NibDesignable
FUIBannerMessageView
shows an overlay message centered in the screen underneath a navigation bar. FUIBannerMessageView
must be attached to a UINavigationBar
to make it work properly. FUINavigationBar
contains a FUIBannerMessageView
by default.
Call show()
on a FUIBannerMessageView
instance to show the message. By default, the message is shown centered on screen for two seconds.
Usage
FUINavigationBar
has a FUIBannerMessageView
prepared for you. Usually you don’t need to create an instance of it.
Setup
Setup a FUINavigationBar
in your navigation controller. You can set either in a nib file or programmatically.
Show message
guard let navBar = self.navigationController?.navigationBar as? FUINavigationBar else {
return
}
navBar.bannerView?.show(message: This is a test banner
, withDuration: 1, animated: true)
-
The content view of
FUIBannerMessageView
instance.Declaration
Swift
@IBOutlet open var view: UIView!
-
The view which adds blurry effect.
Declaration
Swift
@IBOutlet open weak var blurView: UIVisualEffectView!
-
The label which contains the message.
Declaration
Swift
@IBOutlet open weak var titleLabel: UILabel!
-
The view serves as top divider.
Declaration
Swift
@IBOutlet open weak var dividerTop: UIView!
-
The view serves as bottom divider.
Declaration
Swift
@IBOutlet open weak var dividerBottom: UIView!
-
The navigation bar which this
FUIBannerMessageView
instance attacheds to.Declaration
Swift
open weak var navigationBar: UINavigationBar?
-
Show the banner with a message under navigation bar for a certain duration.
Declaration
Swift
open func show(message: String, withDuration duration: TimeInterval = 2, animated: Bool = true)
Parameters
message
The message which will show on the banner.
duration
The duration in seconds for which the toast message is shown. The default is
2
.animated
Whether the banner is shown with an animation. The default is
true
. -
Dismiss the banner.
Declaration
Swift
open func dismissBanner(animated: Bool)
Parameters
animated
Whether the banner should dismiss with an animation.