In my app I'm switching between UIViewController
using Navigation Controller and the Action Segue "Show". But for example if I write something in a UITextView
and I return in that UIViewController
the text is deleted. How I can keep the information ? Like in the UITabBarController
.
Asked
Active
Viewed 46 times
0
-
Possible Duplicate of [1]: http://stackoverflow.com/a/17756677/2990958 hope it helps. – KP_G Apr 16 '15 at 11:17
-
I'm not sure if that is the easiest way – Apr 16 '15 at 11:24
-
for an easier solution : http://stackoverflow.com/a/12169660/2990958. – KP_G Apr 16 '15 at 11:26
2 Answers
0
You can create uiviewcontroller objects in app delegate and use that objects for swapping between view controllers. In current scenario, whenever you load same view controller again, it is created as fresh object so UITextView is initialized again, so text you entered will not be saved.
Or you can save value of UITextView in global variable or NSUserDefaults on viewwilldisappear() and initialize again in viewwillappear()

Shefali Soni
- 1,234
- 14
- 26