         self.deleteKeyboardButton.layer.shadowColor = shadowColor.CGColor
     }
     
+    override func viewDidLayoutSubviews() {
+        super.viewDidLayoutSubviews()
+        
+        if let heightConstraints = self.buttonHeightConstraints {
+            self.view.removeConstraints(heightConstraints)
+        }
+        if let spacingConstraints = self.buttonSpacingConstraints {
+            self.view.removeConstraints(spacingConstraints)
+        }
+
+        if ((UIDevice.currentDevice().userInterfaceIdiom == .Phone) && (UIScreen.mainScreen().bounds.size.width > UIScreen.mainScreen().bounds.size.height)) {
+            var nameKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.nameKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 30.0)
+            var surnameKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.surnameKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 30.0)
+            var mailKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.mailKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 30.0)
+            var nextKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.nextKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 30.0)
+            var deleteKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.deleteKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 30.0)
+            self.buttonHeightConstraints = [nameKeyboardButtonHeightConstraint, surnameKeyboardButtonHeightConstraint, mailKeyboardButtonHeightConstraint, nextKeyboardButtonHeightConstraint, deleteKeyboardButtonHeightConstraint]
+            
+            var nameKeyboardButtonTopConstraint = NSLayoutConstraint(item: self.nameKeyboardButton, attribute: .Top, relatedBy: .Equal, toItem: self.view, attribute: .Top, multiplier: 1.0, constant: 8.0)
+            var surnameKeyboardButtonTopConstraint = NSLayoutConstraint(item: self.surnameKeyboardButton, attribute: .Top, relatedBy: .Equal, toItem: self.nameKeyboardButton, attribute: .Bottom, multiplier: 1.0, constant: 8.0)
+            var mailKeyboardButtonTopConstraint = NSLayoutConstraint(item: self.mailKeyboardButton, attribute: .Top, relatedBy: .Equal, toItem: self.surnameKeyboardButton, attribute: .Bottom, multiplier: 1.0, constant: 8.0)
+            self.buttonSpacingConstraints = [nameKeyboardButtonTopConstraint, surnameKeyboardButtonTopConstraint, mailKeyboardButtonTopConstraint]
+        }
+        else {
+            var nameKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.nameKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 41.0)
+            var surnameKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.surnameKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 41.0)
+            var mailKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.mailKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 41.0)
+            var nextKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.nextKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 41.0)
+            var deleteKeyboardButtonHeightConstraint = NSLayoutConstraint(item: self.deleteKeyboardButton, attribute: .Height, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1.0, constant: 41.0)
+            self.buttonHeightConstraints = [nameKeyboardButtonHeightConstraint, surnameKeyboardButtonHeightConstraint, mailKeyboardButtonHeightConstraint, nextKeyboardButtonHeightConstraint, deleteKeyboardButtonHeightConstraint]
+            
+            var nameKeyboardButtonTopConstraint = NSLayoutConstraint(item: self.nameKeyboardButton, attribute: .Top, relatedBy: .Equal, toItem: self.view, attribute: .Top, multiplier: 1.0, constant: 12.0)
+            var surnameKeyboardButtonTopConstraint = NSLayoutConstraint(item: self.surnameKeyboardButton, attribute: .Top, relatedBy: .Equal, toItem: self.nameKeyboardButton, attribute: .Bottom, multiplier: 1.0, constant: 12.0)
+            var mailKeyboardButtonTopConstraint = NSLayoutConstraint(item: self.mailKeyboardButton, attribute: .Top, relatedBy: .Equal, toItem: self.surnameKeyboardButton, attribute: .Bottom, multiplier: 1.0, constant: 12.0)
+            self.buttonSpacingConstraints = [nameKeyboardButtonTopConstraint, surnameKeyboardButtonTopConstraint, mailKeyboardButtonTopConstraint]
+        }
+
+        self.view.addConstraints(self.buttonHeightConstraints!)
+        self.view.addConstraints(self.buttonSpacingConstraints!)
+    }
+    
     // MARK: - Actions
 
     @IBAction func addName(sender: UIButton) {

    var surname: String?
    var mail: String?
    
    override func updateViewConstraints() {
        super.updateViewConstraints()
    

        self.nextKeyboardButton.layer.shadowOffset = CGSizeMake(0.0, 1.0)
        self.nextKeyboardButton.addTarget(self, action: "advanceToNextInputMode", forControlEvents: .TouchUpInside)
        self.view.addSubview(self.nextKeyboardButton)
        
        // Delete keyboard button.
        self.deleteKeyboardButton = UIButton.buttonWithType(.System) as UIButton
