[Solved] Textfield values set to empty when coming back from previous view controller [closed]


  • When you push back to the origin viewController, It’s better to replace using “push” Segue by “popViewController” method .
  • It’s also good using data consistent strategy.
  • And the reason:
    You should consider the viewController’s lifecycle.
    When you push back to the origin viewController, using “push” Segue makes the origin viewController’s “viewDidLoad” method is called again.
    Then the unchosen textfield’s value(stringVal2) is reset to nil.
    So not saved.

2

solved Textfield values set to empty when coming back from previous view controller [closed]