更新到 Catalina 和 pod update
后我收到错误
Type 'UIResponder' has no member 'NSNotification'
这是给 iOSDropDown 的
if isSearchEnable && handleKeyboard{
NotificationCenter.default.addObserver(forName: UIResponder.NSNotification.Name.UIKeyboardWillShow, object: nil, queue: nil) { (notification) in
if self.isFirstResponder{
let userInfo:NSDictionary = notification.userInfo! as NSDictionary
let keyboardFrame:NSValue = userInfo.value(forKey: UIResponder.UIKeyboardFrameEndUserInfoKey) as! NSValue
let keyboardRectangle = keyboardFrame.cgRectValue
self.keyboardHeight = keyboardRectangle.height
if !self.isSelected{
self.showList()
}
}
}
NotificationCenter.default.addObserver(forName: UIResponder.NSNotification.Name.UIKeyboardWillHide, object: nil, queue: nil) { (notification) in
if self.isFirstResponder{
self.keyboardHeight = 0
}
}
}
最佳答案
您现在将在UIResponder
上直接使用keyboardWillShowNotification
,如前所述here在类型属性下,
NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillShowNotification, object: nil, queue: nil)
注意:由于错误出现在外部库中,您可以fork
库,解决问题并在 podfile 中指向您的 fork 版本
。或者,您可以选择在本地计算机上进行更改,但每次您执行 pod update
时它都会被覆盖。
关于swift - iOSDropDown : Type 'UIResponder' has no member 'NSNotification' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58361534/