How to launch a new screen in IOS?
ios
Solution
The best way to do this is to use a navigation controller.
In the AppDelegate applicationWillFinishLaunchingWithOptions put this...
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:<the view controller you want to use first>];
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];
This will launch your app with a NavigationController and the first thing you see will be your initial view controller.
To hide the bar...
In the viewWillAppear part of your initial view controller...
[self.navigationController setNavigationBarHidden:YES animated:YES];
This will hide the navigation bar for that controller.
To push to a new view controller...
MyNewViewController *newVc = [[MyNewViewController... (set it up).
[self.navigationController pushViewController:newVc animated:YES];
This is done from the initial view controller.
Then to pop back. In the new VC just do this...
[self.navigationController popViewControllerAnimated:YES];
You'll never really "own" the navigation controller and you'll never really see it. It just sits behind your app managing the transitions and stuff.
Problem
This is a very simple question, but I don't find how to do it. The first thing I found was that I have to add a navigation controller. Although I don't need to show a navigation controller, I tried it. I found these tutorials: http://www.ralfebert.de/tutorials/iosdev/navigationcontroller/ http://www.techotopia.com/index.php/Creating_a_Navigation_based_iOS_4_iPhone_Application_using_TableViews http://iosmadesimple.blogspot.de/2012/09/navigation-based-project-doing-it-using.html and others, where it says, I have to connect the navigation controller to window object. But in the .xib there is no window object. There seems to be some update, I found window object created programmatically in AppDelegate.m Does it mean that I have to connect them programmatically, if yes, how? I'm using Xcode 4.4.1 building for 5.1. Then I found hacky approach, to replace views described here: http://fuelyourcoding.com/ios-basics-how-to-load-a-uiview-without-a-navigation-controller/ But I want to know what's the standard way to do it. In Apple's dev guide is something about storyboards. Is that what I need? I need to know how I launch a separate, new screen (with own controller and .xib of course), if possible, without having to add a navigation bar to the app.