         delButton.setTitleColor(UIColor.black, for: .normal)
         delButton.addTarget(self, action: #selector(DelMethod), for: .touchUpInside)
         view.addSubview(delButton)
-        
     }
     
     @objc func upMethod() {
-        
+        if mytext.text != "" {
+            myUserDefault.set(mytext.text, forKey: "MyInput")
+        }
     }
     
     @objc func DelMethod() {
-        
+        myUserDefault.removeObject(forKey: "MyInput")
+    }
+}
+//set the delegate and hide the keyborder
+extension ViewController: UITextFieldDelegate {
+    func textFieldShouldReturn(_ textField: UITextField) -> Bool {
+        mytext.resignFirstResponder()
+        return true
     }
 }
 
 
 
 
-

    var mytext: UITextField!
    var upButton: UIButton!
    var delButton: UIButton!

    override func viewDidLoad() {
        super.viewDidLoad()
        setupNav()
        setupUI()
    }

   @objc func showMyInfo() {
    
    }
}

        mytext.center = CGPoint(x: view.bounds.width * 0.5, y: view.bounds.height * 0.3)
        mytext.textAlignment = .center
        mytext.placeholder =  "please inuput"
        mytext.delegate = self
        view.addSubview(mytext)
        
        upButton = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: 40))
