I have 1 textfields in my application. I can write something in and it works but if I go to the next page all the data is erased. How can the data be saved? I have also attached its class viewcontroller if that helps.
import UIKit
class ViewController: UIViewController {
@IBAction func button(sender: AnyObject) {
let myTextField: UITextField = UITextField(frame: CGRect(x: 100, y: 575, width: 200.00, height: 40.00));
myTextField.layer.borderColor = UIColor.grayColor().CGColor
myTextField.layer.borderColor = UIColor.redColor().CGColor
myTextField.backgroundColor = UIColor.greenColor()
myTextField.layer.borderWidth = 1.5
self.view.addSubview(myTextField)
myTextField.text = "Hello"
print(myTextField)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}