Hi so I have a text field in a Modal ViewController that adjusts a TabBarItem title in a different view. The problem is that the text field clears once you leave the Modal ViewController. How can I keep the text in the text field so that when I return it is still there?
Share
Each time you present a view controller modally, you’re instantiating a new one (and so is the textfield that’s why it’s empty)
You can easily solve this by adding an NSString property to the view controller you’re presenting modally (to the .h file)
(you also need to synthesize it)
and in your viewDidLoad set the textfield’s text
By keeping it like this it will do nothing because your “text” property is nil,
You need to set it just before you call
presentModalViewController:animated: