问题描述
学习了 SwiftUI 2.0 的所有新变化,但遇到了 .navigationTitle
,它的工作方式几乎与 .navigationBarTitle
完全一样.我查看了 WWDC 2020 视频,发现了一个视频,其中提到它用于区分 MacOS 中的标签标题?但不确定我现在是否应该在 iOS 中使用它而不是 .navigationBarTitle
?此外,Apple 文档也不清楚两者之间的区别..
Learning all the new SwiftUI 2.0 changes but came across .navigationTitle
which seems to work almost exactly like .navigationBarTitle
. I looked at the WWDC 2020 videos and found one video where it was mentioned as being used to distinguish tab titles in MacOS? But not sure if it I should use it now instead of .navigationBarTitle
in iOS? Also the Apple documentation is not clear about the differences between the two..
所以我的问题是,确切的区别是什么,您将如何在 iOS/MacOS 中使用它们?
So my question is, what are the exact differences and how would you use them in iOS/MacOS?
推荐答案
navigationBarTitle
刚刚被弃用并重命名为 navigationTitle
:
The navigationBarTitle
is just deprecated and renamed to navigationTitle
:
@available(iOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
@available(macOS, unavailable)
@available(tvOS, introduced: 13.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
@available(watchOS, introduced: 6.0, deprecated: 100000.0, renamed: "navigationTitle(_:)")
public func navigationBarTitle(_ title: Text) -> some View
这篇关于SwiftUI 2.0 中的 navigationBarTitle 和 navigationTitle 修饰符有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!