Skip to content

Banner Message View

FUIBannerMessageView

open class FUIBannerMessageView: NibDesignable

FUIBannerMessageView shows an overlay message centered in the screen underneath a navigation bar, or one of FUIObjectHeader, FUIProfileHeader, and FUIKPIHeader. FUINavigationBar contains a FUIBannerMessageView by default.

Call show function on a FUIBannerMessageView instance to show the message. By default, the message is shown centered on screen.

Usage

FUINavigationBar has a FUIBannerMessageView prepared for you. Usually you don't need to create an instance of it. For FUIObjectHeader, FUIProfileHeader, and FUIKPIHeader, however, you need to allocate a FUIBannerMessageView or its subclasses to the bannerMessage property of the corresponding header view.

Setup

To display the banner message in a navigation bar, 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)
/// An example of a UITableViewController with `FUIBannerMessageView` in an `FUIObjectHeader`
class BannerObjectHeaderBannerTVC: UITableViewController {

    let objectHeader = FUIObjectHeader()

    let bannerView = FUIBannerMessageView()

    override func viewDidLoad() {
        self.tableView.tableHeaderView = objectHeader
        super.viewDidLoad()

        bannerView.isFading = false
        objectHeader.bannerView = bannerView
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        bannerView.show(message: "200k pending to upload example with text showing wrapping to two lines", withDuration: 5 ,animated: true)
    }

    // ...
}

Theming

Supported style classes

fdlFUIBannerMessageView
fdlFUIBannerMessageView_titleLabel
fdlFUIBannerMessageView_dividerTop
fdlFUIBannerMessageView_dividerBottom
fdlFUIBannerMessageView_blurView
fdlFUIBannerMessageView_contentView
fdlFUIBannerMessageView_closeImage

Last update: April 14, 2021