Ios 如何使UITextField中的文本全部小写?
我对firebase有以下查询,firebase搜索用户名Ios 如何使UITextField中的文本全部小写?,ios,swift,firebase,firebase-realtime-database,uitextfield,Ios,Swift,Firebase,Firebase Realtime Database,Uitextfield,我对firebase有以下查询,firebase搜索用户名 let ref = Database.database().reference().child("UsernameIndex") ref.queryOrdered(byChild: "username").queryStarting(atValue: username).queryEnding(atValue: username+"\u{f8ff}").observeSingleEvent(of: .value)
let ref = Database.database().reference().child("UsernameIndex")
ref.queryOrdered(byChild: "username").queryStarting(atValue: username).queryEnding(atValue: username+"\u{f8ff}").observeSingleEvent(of: .value) { snap in
问题是,如果我在任何时候键入upercase,它都不会进行搜索,那么如何使所有leters变为小写,或者使文本变为小写,或者使查询不区分大小写
我所能做的使文本小写的最好方法是:
searchField.autocapitalizationType = .none
searchField.autocorrectionType = .no
searchField.spellCheckingType = .no
但这仍然允许用户输入大写字母 我只想将文本转换为小写的searchField.text.lowercased,并允许用户键入大写字母。这将避免用户在尝试键入大写字母时感到沮丧