SwiftUI - @Binding
生活随笔
收集整理的這篇文章主要介紹了
SwiftUI - @Binding
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
文章目錄
- 使用@Binding綁定包裝關(guān)閉模態(tài)窗口
使用@Binding綁定包裝關(guān)閉模態(tài)窗口
struct ContentView : View {@State var isPresented = falsevar body: some View{PopView(show: $isPresented).sheet(isPresented: $isPresented, content:{Button(action:{self.isPresented.toggle()}){Text("Dismiss").font(.largeTitle)}})} }struct PopView: View {@Binding var show : Boolvar body: some View{Button(action:{self.show.toggle()}) {Image(systemName: "person.crop.circle").font(.system(size: 32)).frame(width: 64, height: 64).foregroundColor(.black).background(Color.white).cornerRadius(30).shadow(color: .pink, radius: 10, x: 0, y: 10)}} }
總結(jié)
以上是生活随笔為你收集整理的SwiftUI - @Binding的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: char * 与char []区别总结
- 下一篇: 数值积分求解卫星轨道长(Python)