-2

I have two viewcontrollers. vc1 is a form that holds the user's input values.vc2 is a canvas. I have a button in vc1 that shows vc2. How do I preserve the values in vc1 so when the user closes vc2, vc1 has the values previously inputted?

I know NSUserDefaults, but it would require more work. I'm just wondering if I show vc2 as modal via segue, is it possible to preserve the values of vc1?

Here's how I show vc2: enter image description here

Here's how I dismiss vc2: enter image description here

Thanks!

Jayson Tamayo
  • 2,741
  • 3
  • 49
  • 76
  • Isn't it so that when you present vc2 from vc1, the presenting instance of vc1 is still alive and has all the properties intact. – Sandeep Mar 28 '16 at 15:32

1 Answers1

-1

How do I preserve the values in vc1 so when the user closes vc2, vc1 has the values previously inputted

If you're doing this correctly, those values never went away. There is nothing to do. When VC2 is dismissed, VC1 was always in existence and was never changed. If that's not what you are seeing, then you are not properly dismissing VC2. (Perhaps you are making the elementary beginner mistake of presenting a whole new copy of VC1 instead.)

matt
  • 515,959
  • 87
  • 875
  • 1,141