Question

I'm creating an App for Ipad, I created 3 views with a navigation bar but I would to start my application not in first but in second view, what can i do?

Was it helpful?

Solution

You can setup UINavigationController with an initial navigation stack via setViewControllers:animated:.

// in application:didFinishLaunchingWithOptions:

self.navigationController = [[UINavigationController new] autorelease];

UIViewController *first = [[MyFirstViewController new] autorelease];
UIViewController *second = [[MySecondViewController new] autorelease];
NSArray *controllers = [NSArray arrayWithObjects:first, second, nil];

[navigationController setViewControllers:controllers animated:NO];

...
[window addSubview:navigationController.view];

OTHER TIPS

Initialise your navigation controller on startup programmatically with 2 controllers already in stack:

FirstViewController *first = ...//create controller
SecondViewController *second = ...//create controller

[navigationController setViewControllers:[NSArray arrayWithObjects:first, second, nil]
                                animated:NO];

Or alternatively you can make your 1st controller push the second one on startup - see Apple's DrillDownSave sample for that technique.

Follow somesteps as:

1.open the MainWindow.xib in resource folder or bundle.

2.click on Tool and open Inspector >> choose attribute >> NIB Name-set here your view name from drop down list >> identity in inspector(from upper tabs) >> choose class -set here your view name again from drop down list.

3.Open appdelegate.m file change here the view controller as : fileviewcontrollername *viewController; set it's property.

4.in didFinishLaunching in appdelegate.m add

UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:viewController];[window insertSubview:navController.view];[self.window makeKeyAndVisible];return YES;

5.In appdelegate.h file add

@class viewControllername;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top