网站建设的流程图示/什么是seo
实战需求
SwiftUI 核心组件之仿侧边栏效果
本文价值与收获
看完本文后,您将能够作出下面的界面
看完本文您将掌握的技能
- 组件偏移.offset(x: showMenu ? 0 : -UIScreen.main.bounds.width / 1.6)
- 背景颜色.background(Color.white.ignoresSafeArea())
- 屏幕宽度.frame(width: UIScreen.main.bounds.width / 1.6)
实战代码
1、主界面
import SwiftUIstruct ContentView: View {@State var showMenu = falsevar body: some View {// ZStack{NavigationView{VStack(spacing: 10){HStack(spacing: 15){Button(action: {withAnimation(.e