A description of this view to display in the navigation bar. ナビゲーションバーにおいて表示するためのこのビューの説明。
Instance Method
インスタンスメソッド
navigation
navigationBarTitle(_:)
Sets the title in the navigation bar for this view.
このビューのナビゲーションバーにおけるタイトルを設定します。
Availability 有効性
- iOS 13.0–15.4 Deprecated
- iPadOS 13.0–15.4 Deprecated
- Mac Catalyst 13.0–15.4 Deprecated
- tvOS 13.0–15.4 Deprecated
- watchOS 6.0–8.5 Deprecated
Technology
- Swift
UI
Declaration 宣言
Parameters パラメータ
title
Discussion 議論
Use navigation
to set the title of the navigation bar. This modifier only takes effect when this view is inside of and visible within a Navigation
.
The example below shows setting the title of the navigation bar using a Text
view:
struct FlavorView: View {
let items = ["Chocolate", "Vanilla", "Strawberry", "Mint Chip",
"Pistachio"]
var body: some View {
NavigationView {
List(items, id: \.self) {
Text($0)
}
.navigationBarTitle(Text("Today's Flavors"))
}
}
}