Loading a storyboard manually

Discussion in 'iOS Programming' started by nashyo, Jan 15, 2013.

  1. macrumors 6502


    Oct 1, 2010
    I want to change how the storyboard is loaded in my App. I am having immense difficulty. All my searchings through Google has failed.

    I am using an Apple Dev Video for guidance 'WWDC 2012 Adopting Storyboards in your App' - which describes how to add a storyboard (in the hope that I can learn more of what little support is out there).

    So far: I have removed the storyboard name from 'Main Storyboard' in the 'summary' section of project settings.

    I have updated the App delegate as follows:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
        UIStoryboard *authStoryboard = [UIStoryboard storyboardWithName:@"Authenticate_iPad" bundle:nil];
        UINavigationController *navigationController = [authStoryboard instantiateInitialViewController];
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        self.window.rootViewController = navigationController;
        [self.window makeKeyAndVisible];
        return YES;
    Error: Could not instantiate NSLayoutConstraint

    Any ideas?
  2. macrumors demi-god


    Oct 16, 2006
    Quick question, are you building and targeting for iOS 5? If so you need to disable AutoLayout as it is not supported in iOS 5, its only supported in iOS 6. The reason I ask is that you are probably using XCode 4.5.x and when you create a new nib or storyboard autolayout is enabled by default. If you are targeting iOS 5 it will not work.

    You can disable auto layout on the storyboard by opening the storyboard and pressing command option 1 which will open the inspector view for the nib/storyboard. About half way down it will have a check box for auto layout. You simply need to uncheck the box.

    See image below:
  3. thread starter macrumors 6502


    Oct 1, 2010

Share This Page