-1

I'm using Matthew York's great drop in https://github.com/MatthewYork/iPhone-IntroductionTutorial to display a HUD for my App to give an intorduction overview to it's features and functionality.

However i'm seeing this load each time the application loads. I've followed the instructions but think i'm catching myself out by placing the calls and commands in my first view which loads on view as the default and thus loading each time the app loads.

Where would be the best place to launch this from?

Any help would be great!

  • It's difficult to understand what you are asking here. If you want to show something only for the first load of application, use NSUserDefaults to keep a value denoting if it's first launch or not. – Anupdas Jun 02 '13 at 14:39

1 Answers1

1

If I understand the question, you wish to have a piece of code only run once. If so then I suggest using NSUserDefaults to keep track of whether or not your code has already run once.

The first time your code runs you can store it as already having run like this:

NSString *valueToSave = @"Yes";
[[NSUserDefaults standardUserDefaults] setObject:valueToSave forKey:@"IntroRun"];

Subsequent launches can check if the code has already run by doing this:

NSString *savedValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"IntroRun"];
If([savedValue isEqualToString@"Yes"]){
// code has already run once...
} else {
// code has not been run
}
sangony
  • 11,636
  • 4
  • 39
  • 55
  • Used this in the end, http://stackoverflow.com/questions/1664177/best-way-to-check-if-an-iphone-app-is-running-for-the-first-time – danielsteel Jun 02 '13 at 20:13