0

I have several viewcontrollers which uses pedometer, and reading a value like 100, it goes to another viewcontroller, it still reads the value and display in print()

here's a flow, 1(home) -> 2(game/reads value) -> 3(done/result) -> 1(home)

to jump controllers to controllers,

I'm using this code (I wanted to keep it simple so this is the one that I'm using)

    var vee : missionSuccessViewController = storyboard!.instantiateViewControllerWithIdentifier("success") as! missionSuccessViewController

    self.presentViewController(vee, animated: true, completion: nil)

But the thing is it keeps saving the value that read in 2 so after going back to 1 and play another game, it now has 2 values, one is 140 and the new one starts with 12 and so on.

It's like they are stacking on top of each other so it causes an error.

Is there anyway that I can make the 2 viewcontroller go away and restart the viewcontroller from 1(home)?

Just like a game, make every viewcontroller disappear and restart.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Chris Lee
  • 1
  • 2
  • Is [this what you want](http://stackoverflow.com/questions/12561735/what-are-unwind-segues-for-and-how-do-you-use-them) or something else? – vale Nov 28 '15 at 21:19
  • thank you! for posting this! but the new version of xcode doesn't allow the drag and exit.. I tried dragging my button and move it to exit icon and it doesn't work, it only allows me to go to that viewcontroller without EXITing completely... :( – Chris Lee Dec 01 '15 at 17:16

0 Answers0