I am trying to have a simple Navigation in my iOS-Project but nothing worked. I am trying since hours and I just don’t get it why it so difficult (I have Windows 8, Windows Phone 8 and Android Apps in the Store).
I have a View which is connected to my Class MainMenu. In the header, I refere to the header of mainmenu.h. And i create a object MainMenuView which is based on the Class MainMenu. In the m-File, I initialize the MainMenuView:
MainMenuView = [[MainMenu alloc] init];
Just for test purpose, I set a Title and this is the only thing which works:
[MainMenuView.navigationItem setTitle:@"Main View"];
I tried a lot of different lines but no lines does the job (simply show the MainMenuView…)
[window addSubview:[navController view]];
UINavigationController *newnav = [[UINavigationController alloc] initWithRootViewController:MainMenuView];
[self setNavController:newnav];
[window addSubview:[navController view]];
[self.navController pushViewController: MainMenuView animated:YES];
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];
I added this to the first line, because I read it in some tutorial, but did not help:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
So, simply I just wwant to display my MainMenu using UINavigationController. Later on, I want to use UINavigationController to navigate to specific Views by pressing specific buttons…
This line would actually crash my app:
[self.navController pushViewController: MainMenuView animated:YES];
I had to use instantiateviewcontrollerwithidentifier, nothing else worked… But this is not written in any documentation or something else, I found it after hours of googling… 🙁