赞
踩
可以使用 NSSplitViewController 中的 toggleSidebar () 功能显示或隐藏侧边栏视图。在撰写本文时,SwiftUI 还没有此功能,但希望即将到来的 WWDC 将提供 SwiftUI 解决方案。
import SwiftUI struct Sidebar: View { var body: some View { List { Label("Books", systemImage: "book.closed") Label("Tutorials", systemImage: "list.bullet.rectangle") Label("Video Tutorials", systemImage: "tv") Label("Contacts", systemImage: "mail.stack") Label("Search", systemImage: "magnifyingglass") } .listStyle(SidebarListStyle()) .toolbar { Button(action: toggleSidebar, label: { Image(systemName: "sidebar.left").help("Toggle Sidebar
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。