跳转至
Structure

NavigationBarItem

A configuration for a navigation bar that represents a view at the top of a navigation stack.

Declaration

struct NavigationBarItem

Overview

Use this structure's members to configure the appearance of a navigation bar. Currently, there is only one member: TitleDisplayMode. Below is a simple example, but see TitleDisplayMode for more on when and how to use the options.

struct ContentView: View {
    let mode = NavigationBarItem.TitleDisplayMode.large

    var body: some View {
        NavigationView {
            Text("Hello Bananas🍌🍌")
                .navigationTitle("Home")
                .navigationBarTitleDisplayMode(mode)
        }
    }
}
A navigation view displaying the plain text "Hello Bananas🍌🍌" under a navigation title with display mode .large that reads "Home".

Availability

iOS 13.0+

tvOS 13.0+

watchOS 6.0+

Topics


Enumeration

TitleDisplayMode A style for displaying the title of a navigation bar.