aes_256_cbc
还尝试了两个退格键
@objc func searchButtonTap() {
searchBar.becomeFirstResponder()
var remove = searchBar.text
remove = String(remove!.dropLast())
searchBar.text = remove
}
答案 0 :(得分:0)
假设您要在用户点击后退(搜索?)按钮时删除搜索栏文本的最后一个字符。 因此,
@objc func searchButtonTap() {
guard !(searchBar.text?.isEmpty ?? true) else { return } //Making sure that you don't hit the "Fatal error: Can't remove more items from a collection than it contains"
searchBar.text?.removeLast(1)
}