Home > AI > IOS > SwiftUI >

shadow background

Method 1: ZStack

struct SlideSideMenuView: View {
        
    var body: some View {
        ZStack(alignment: Alignment(horizontal: .leading, vertical: .center)){
            Color.white
                .shadow(radius: 10)
                .edgesIgnoringSafeArea(.all)
            
            VStack{
                ZStack{
                    Divider()
                    Text("选择")
                        .background(Color.white)
                        .foregroundColor(Color.gray.opacity(0.7))
                }
                .padding()
         
            }
        }
        .frame(width: UIScreen.main.bounds.width / 2)
    }
}

Leave a Reply