     
     private func setup() {
         self.toolbar.items = [cancelBarButton, flexibleSpace, doneBarButton]
-
+        self.tapView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(cancel)))
         
         self.frame = defaultFrame
         self.addSubview(textField)

        if textField.isFirstResponder {
            textField.resignFirstResponder()
            self.removeFromSuperview()
        } else {
            appWindow.addSubview(self)
            textField.becomeFirstResponder()
        }

        didSet {
            textField.frame = CGRect.init(x: 0, y: 0, width: defaultFrame.size.width, height: textFieldHeight)
            toolbar.frame = CGRect.init(x: 0, y: textFieldHeight, width: defaultFrame.size.width, height: toolbarHeight)
            tapView.frame = CGRect.init(x: 0, y: 0, width: appWindow.bounds.size.width, height: appWindow.bounds.size.height)
        }
    }
    
    private let tapView:UIView = UIView()
    private let doneBarButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(KMKeys.done))
    private let cancelBarButton = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(KMKeys.cancel))
    private let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
