             make.width.equalTo(self.usernameField.snp_width).offset(10.0)
         }
 
+        self.view.insertSubview(visibleLayoutGuide, atIndex: 0)
+        visibleLayoutGuide.userInteractionEnabled = false
+        visibleLayoutGuide.snp_makeConstraints { (make) in
+            make.edges.equalTo(self.view)
+        }
+
         state = self.inLoginState() ? .Login : .NotLogin
 
         let tapGesture = UITapGestureRecognizer(target: self, action: #selector(S1LoginViewController.dismiss))

    }

    private func centerOfContainerView() -> CGPoint {
        // FIXME: should be center of visibleLayoutGuide i.e. the space not covered by keyboard.
        return CGPoint(x: self.view.center.x, y: self.view.center.y)
    }

    private func offsetFromCenter(touchPointInView: CGPoint, viewCenter: CGPoint) -> UIOffset {

        let dragGesture = UIPanGestureRecognizer(target: self, action: #selector(S1LoginViewController.pan(_:)))
        self.view.addGestureRecognizer(dragGesture)
        self.dragGesture = dragGesture

        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(S1LoginViewController.keyboardFrameWillChange(_:)), name: UIKeyboardWillChangeFrameNotification, object: nil)
    }

    deinit {
        NSNotificationCenter.defaultCenter().removeObserver(self)
    }

    override func viewDidLayoutSubviews() {
