gpt4 book ai didi

swift - iOSDropDown : Type 'UIResponder' has no member 'NSNotification'

转载 作者:行者123 更新时间:2023-11-28 13:25:59 29 4
gpt4 key购买 nike

更新到 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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com