I went through all similar questions on stackoverflow, but questions are quite stale. Since then Xcode has been updated multiple times, and the answers are not working for me.
I am extremely new to iOS development. I just want to open a new view controller once the user is logged in.
I am only using storyboards. I don't have .xib file, since I followed Apple's iOS tutorial.
Created a single view project. Removed original view controller. (Changed this to LoginViewController, was causing problems.)
Added two new view controllers: LoginViewController and MainMenuViewController. Both have navigation controllers embedded. I also set LoginViewController as the initial view controller of the storyboard.
According to this post added the following code:
(Navigation Controller Push View Controller)
In LoginViewController.m:
- (IBAction)GoToMainMenu:(id)sender
{
MainMenuViewController* controller = [[MainMenuViewController alloc] init];
[self.navigationController pushViewController:controller animated:YES];
}
In AppDelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions
:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] initWithNibName:@"LoginViewController"
bundle:nil];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = navigation;
[self.window makeKeyAndVisible];
return YES;
}
In the above code, it said:
self.viewController is not found on object of type 'AppDelegate'
My question is how to accomplish this task using Xcode 6.0.1 and storyboards?