[英]change the position of Masterview from left to right in Splitviewcontroller
[英]Change navigation title position from left to right
我正在嘗試將導航標題移動到右側而不是左側,您知道如何實現嗎?
init() {
UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor.white]
}
var body: some View {
NavigationView {
Color.init("midnight blue")
.edgesIgnoringSafeArea(.vertical)
.navigationBarTitle("המרות מטבע")
.navigationBarItems(trailing:
Button(action: {
print("button pressed")
}) {
Image(systemName: "plus")
.foregroundColor(Color.orange)
})
}
}
我想這就是你要找的。 但考慮到這是由 iOS 自動應用的,具體取決於您的語言設置。
NavigationView {
Color.init("midnight blue")
.edgesIgnoringSafeArea(.vertical)
.navigationBarTitle("המרות מטבע")
.navigationBarItems(trailing:
Button(action: {
print("button pressed")
}) {
Image(systemName: "plus")
.foregroundColor(Color.orange)
})
}.environment(\.layoutDirection, .rightToLeft)
您可以使用 navigationBarItem,您可以在其中自定義文本。 對我來說,這段代碼正在工作:
.navigationBarItems(trailing: Text("Title on Right"))
.navigationBarTitle(Text(""), displayMode: .inline)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.