You can modify the font size of the NavigationTitle in SwiftUI by setting the titleTextAttributes modifier on the navigation bar. Here's an example:
NavigationView {
Text("Hello World!")
.navigationTitle("My Title")
.navigationBarTitleDisplayMode(.inline)
.navigationBarTitle("My Title")
.navigationBarTitleDisplayMode(.inline)
}
.navigationViewStyle(StackNavigationViewStyle())
.onAppear {
let appearance = UINavigationBarAppearance()
appearance.largeTitleTextAttributes = [
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 36)
]
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().compactAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
}
In this example, we set the font of the title to be a system font with a size of 36. You can adjust the size to fit your needs. The appearance object is used to set the font for all the different states of the navigation bar (standard, compact, and scroll edge). Finally, we apply the appearance to the navigation bar using the UINavigationBar.appearance() method.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-11-20 11:00:00 +0000
Seen: 7 times
Last updated: Nov 12 '21
How can the update of properties from both ParentViewModel and ChildViewModel in SwiftUI be solved?
How can I deal with Expression.Error related to a column in Power Query?
How can you implement pagination in Oracle for the LISTAGG() function?
What is the process for implementing a FutureBuilder on an OnTap function in Flutter?
How can we require users to be logged in before they can access the root folders in WordPress?
In SCSS, what is the method for grouping and reusing a set of classes and styles?
How can popen() be used to direct streaming data to TAR?
How does iOS retrieve information from a BLE device?
How can Django Admin accommodate a variety of formats and locales for its input fields?