iOS-SwiftUI基础-TextField

2020-06-23  本文已影响0人  蓝不蓝编程

效果图

代码

struct ContentView: View {
    @State private var text = ""
    
    var body: some View {
        VStack
            {
                TextField(
                    "输入框提示信息",
                    text: $text,
                    onEditingChanged: { (isChanged) in  if isChanged {
                        print("changed")
                    } else {
                        print("unchanged")
                        } },
                    onCommit: { print("commit") }
                )
        }
    }
}

源代码

https://gitee.com/cxyzy1/iOS_TextFieldDemo

上一篇下一篇

猜你喜欢

热点阅读