捕获用户点击(TextView1或textView2或button1)时的用户时(通过NSNOTIFIFICY)
我想拦截当我到达
@objc func keyboardDidShow(notification: NSNotification) {
guard let userInfo = notification.userInfo else {return}
guard let keyboardSize = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {return}
let keyboardFrame = keyboardSize.cgRectValue
if isheight == 0.0 { isheight = keyboardFrame.height}
if self.view.bounds.origin.y == 0{
self.view.bounds.origin.y += keyboardFrame.height
}
}
VC上的Func键盘DIDSHOW时,用户点击了哪个按钮/textView或#tag,我有这条线可以打电话给func,
NotificationCenter.default.addObserver(self, selector: #selector(keyboardDidShow),name:Responder.keyboardDidShowNotification, object: nil)
有可能吗?
I would like to intercept what button/textview or #tag the user tapped when I reach the func keyboardDidShow
@objc func keyboardDidShow(notification: NSNotification) {
guard let userInfo = notification.userInfo else {return}
guard let keyboardSize = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {return}
let keyboardFrame = keyboardSize.cgRectValue
if isheight == 0.0 { isheight = keyboardFrame.height}
if self.view.bounds.origin.y == 0{
self.view.bounds.origin.y += keyboardFrame.height
}
}
On my VC I have this line to call the func
NotificationCenter.default.addObserver(self, selector: #selector(keyboardDidShow),name:Responder.keyboardDidShowNotification, object: nil)
Is there a possibilty ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论