swift 拦截系统左滑跟返回事件

2020-09-17  本文已影响0人  阿拉斯加的狗

在做键盘弹出跟隐藏时候的bug

1.在嵌套Scrollerview的情况下 touchBeagen事件不能触发

class DictContentScrollView: UIScrollView {

    open override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.next?.touchesBegan(touches, with: event)
        super.touchesBegan(touches, with: event)
    }
    
    open override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.next?.touchesMoved(touches, with: event)
        super.touchesMoved(touches, with: event)
    }
    
    open override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
        self.next?.touchesEnded(touches, with: event)
        super.touchesEnded(touches, with: event)
    }

}

2.在键盘弹出之后 在返回控制器时候不能响应进行隐藏键盘的bug

    override func willMove(toParent parent: UIViewController?) {
        noteKeyBoardView.submit()
    }
上一篇下一篇

猜你喜欢

热点阅读