Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad different view on first run
    text
    copied!<p>I'm programming an app at the moment which requires on the first run for the app toload a different view in which the user can select its prefered settings.Here's the code</p> <p>implementation <strong>AppDelegate.m</strong></p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { // Determining Storyboard identifier for first view // Determining Storyboard identifier for first view NSString *storyboardID = [self hasEverBeenLaunched]? @"MainView" : @"LoginView"; // Setting proper view as a rootViewController self.window.rootViewController = [self.window.rootViewController.storyboardinstantiateViewControllerWithIdentifier: @"view45"] ; </code></pre> <p>It then goes on with the following code:</p> <pre><code>- (BOOL)hasEverBeenLaunched { // A boolean which determines if app has eer been launched BOOL hasBeenLaunched; // Testig if application has launched before and if it has to show the home-login screen to login // to social networks (facebook, Twitter) if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasAlreadyLaunched"]) { // Setting variable to YES because app has been launched before hasBeenLaunched = YES; NSLog(@"App has been already launched"); } else { // Setting variable to NO because app hasn't been launched before hasBeenLaunched = NO; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasAlreadyLaunched"]; [[NSUserDefaults standardUserDefaults] synchronize]; NSLog(@"This is the first run ever..."); } return hasBeenLaunched; } </code></pre> <p>Just a few quick notes: View 45 is the initial starting up view which should only show once, Otherwise the main view controller is ticked under atrributes to be the initial view controller(The one that always loads up at the start, after the first run)</p> <p>So the problem is that it only ever loads view 45 ,the first run view, but whats causing that exactly ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload