Answer the question
In order to leave comments, you need to log in
How to save the user's entered data in the TextField by pressing the "done" key on the keyboard?
Good day everyone! Tell me how to teach the application to remember the user's entered data in the TextField field by pressing the "done" key on the keyboard? There are several TextField and ImageView (the user in the album selects a photo and makes a descriptive part).
Answer the question
In order to leave comments, you need to log in
If anyone is interested, here is the solution!
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var Name: UITextField!
let saveName = NSUserDefaults.standardUserDefaults()
@IBAction func HideKeyboardName(sender: UITextField) {
saveName.setObject(Name.text, forKey: "Name")
}
override func viewDidLoad() {
super.viewDidLoad()
if let text = saveName.stringForKey("Name") {
Name.text = text
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question