admin管理员组文章数量:1123869
I'm trying to customize the toolbar colors in a NavigationSplitView, specifically:
- Set a color for the sidebar's toolbar (which contains the toggle sidebar button)
- Set a different color for the detail view's toolbar (which contains the star button)
Currently, when I use .toolbarBackground()
, the sidebar's color settings seem to override the detail view's settings. For example:
NavigationSplitView {
List {
// Sidebar content
}
.toolbarBackground(.black) // Changes BOTH sidebar and detail toolbar
} detail: {
// Detail content
.toolbarBackground(.blue) // Ignored
}
Result: Black Toolbar Only (I want to maintain split with black and blue toolbars)
I've tried playing with .toolbarVisibility(.hidden)
on the sidebar and .toolbarVisibility(.visible)
on the detail view, but same effect. It only ever follows the sidebar modifiers.
How can I set distinct toolbar colors for each side of the SplitView?
本文标签: swiftSwiftUI NavigationSplitView Distinct Toolbar ColorsStack Overflow
版权声明:本文标题:swift - SwiftUI NavigationSplitView Distinct Toolbar Colors - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736599759a1945196.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论