2

I have an existing iPhone application which starts from a UIViewController.

What I want to do is add two new table views, one which will require the navigation controller. Can anyone provide info on how to retrofit this into my app or will I need to start again from scratch using the navigation template?

3 Answers 3

1

It's perfectly doable, but if you have to ask, you're probably better off creating a new Navigation-based app and copying your view controller and its .xib over to the new project.

Anyway, assuming the navigation controller is the first thing people see, you'll have to open your MainWindow.xib and add a navigation controller to it. Then add a navigation controller outlet to your app delegate and connect them. Then you'll need to set the navigation controller's view as your main window's view.

You can add a table view to any iPhone app fairly easily, just by creating a new UITableViewController subclass from the File -> New command.

Even if you go this route, I would suggest creating a new navigation-based project to use as a template/cheat-sheet.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Frank, you just confirmed my thoughts about having to ask! I'll retrofit the app into a navigation based template and take it from there.
1

Can be done programmatically.

Well I assume you mean the app start first thing to see is the UINavigationViewController + your View Controller.

In your ProjectAppDelegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    UINavigationController *navicon = [[UINavigationController alloc] initWithRootViewController:self.viewController/*your own viewController*/];
    [self.window addSubView:navicon.view];
    [self.window makeKeyAndVisible];
    return YES;
}

If it require a big change, better start from scratch...

Comments

0

copy your .h and .m files and just simply past them in the existing project and just add its refferences

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.