gpt4 book ai didi

swift - 如何解决 UIResponder 无法识别的问题?

转载 作者:行者123 更新时间:2023-11-28 13:42:58 26 4
gpt4 key购买 nike

<分区>

我在 Swift 中制作记事本应用程序时遇到以下问题:

type 'Notification.Name' (aka 'NSNotification.Name') has no member 'UIResponder'

这些是我输入的代码行:

@objc func updateTextView (notification : Notification) {
let userInfo = notification.userInfo!

let keyboardEndFrameScreenCoordinates = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
let keyboardEndFrame = self.view.convert(keyboardEndFrameScreenCoordinates, to: view.window)

if notification.name == Notification.Name.UIResponder.keyboardWillHideNotification {
textView.contentInset = UIEdgeInsets.zero
} else {
textView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: keyboardEndFrame.height, right: 0)
textView.scrollIndicatorInsets = textView.contentInset
}

textView.scrollRangeToVisible(textView.selectedRange)
}

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