Question

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.؟

Was it helpful?

Solution

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

OTHER TIPS

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.

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];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top