TextField使用numberPad类型键盘没有收起的按键
1. 通过window收起键盘(已过期)
UIApplication.shared.keyWindow?.endEditing(true)
2. 使用UIResponder
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
TextField使用numberPad类型键盘没有收起的按键
UIApplication.shared.keyWindow?.endEditing(true)
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
本文标题:SwiftUI TextField收起键盘
本文链接:https://www.haomeiwen.com/subject/yxuxuhtx.html
网友评论