0

I built an application. On the one my views I used TableView. So now I want to change this Table view to a navigation controller.

1- How can I change UITable view to Navigation Controller.؟

3 Answers 3

2

The easiest way to achieve this is to create a new 'Navigation-based Application'. This will set up everything you need. By default this will set you up with simple RootViewController, if you want you can change this to be your TableViewController by editing the application delegate

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

    // Override point for customization after app launch    

    RootViewController *rootViewController = (RootViewController *)[navigationController topViewController];
    rootViewController.managedObjectContext = self.managedObjectContext;

    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];
}

All you need to do is copy your TableViewController into the new project and change the RootViewController to be yours

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

5 Comments

BTW the default navigation app has a TableViewController as the RootController, so just modify it to display the data you need
OK . i add NavigationController to my AppDelegate.h /.m like navigation app project , then on mainview controller i import NavigationController on mainwindow , i connect my delegate from app delegate , and set nib name my viewcontroller . but sill doesn't work !
Dear Liam this is my problem :P can you check it ? multiupload.com/QAF448G1BW
I had a look and changed a few of the files, the main problem was that the mainwindow.xib and delegate were using tring to use a controller it did not need to. Anyway, heres the modified project filefactory.com/file/a165138/n/NaveTest.zip
I should add, I only modified the source to get navigation working, I didn't try to fix anything else. Hope that helps
1

If you have started with one of the template project in XCode find the .xib file for your view and launch InterfaceBuilder by double clicking the .xib file. You can manipulate the view directly by dragging and dropping components as well as adding components from a palette.

I would walk through one of Apples tutorials and get a feel for working with InterfaceBuilder - this tutorial shows adding a view controller.

1 Comment

No really, there is no magic answer... Tear out your UITableView and replace it with a UINavigationController, then readd the UITableView to the UINavigationController.
1

Thank you everybody . finally i figured out :D , just put this code :

UINavigationController *myNav=[[UINavigationController alloc] initWithRootViewController:[[YourViewController alloc] initWithNibName:@"YourViewController" bundle:nil]];
    [self presentModalViewController:myNav animated:YES];

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.