Reputation: 1906
PROBLEM
When a user types into the TextField (landscape mode, or portrait) and rotates the phone the text is lost. Iam Using Different ViewContoller for landscape and portrait for same Page.
QUESTION
How can I prevent the loss of the text ?
Upvotes: 0
Views: 99
Reputation: 1605
You can pass the TextField text from one controller to another using Delegates
or NotificationCenter
Upvotes: 2
Reputation: 3956
If you are using different view controllers its obvious that textfield will lose its value as each of the view controller has its own textfield object. You can have a static variable in which in you can store textfield text in viewWillDisappear
of each the the view controller. And in viewWillAppear
of both view controllers you can set value from your static variable to text property of textfield.
Upvotes: 1