Question

Hi in my application i have small registration from in view controller now i want this registration form to display before the launch image display and it has to open only once when user open first after that it should not display that view controller it has to open the second view directly.Please tell me is this possible or not.

Possible means please tell what is right way to achieve this task i have searched everywhere but I'm not able to find the proper solution for this.

In the register form after clicking the register button it has to go to the second view controller.

Was it helpful?

Solution

It is possible to do this,

to check if the application is loaded for the first time, I recommend you use NSUserDefaults to store a value for that.

    if (![[NSUserDefaults standardUserDefaults] valueForKey:@"firstRunCompleted"])
    {
         //Your code here which you want to run only for the first time.

    }

    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstRunCompleted"];
    [[NSUserDefaults standardUserDefaults] synchronize];

Since First time when the if is called there will not be any value for the key "firstRun". It will execute and once execution is complete, the value will be set to YES and hence the if will not be executed thereafter.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top