ckc123inDC
ckc123inDC

Reputation: 125

RootViewController

I'm learning this right now so the questions might be a little juvenile. Here's what I'm trying to do. I have the first view come up with a cell of the table populated statically, when you select one of the cells it will pull up a form to input data.

Now, I've been reading the documentation about navigation buttons and navigation in general and it seems that I need two separate viewControllers. One for the basic app and another for the new page being brought forward when the cell is picked. Is this correct?

Sorry, this might be a little bit basic but I'm not sure what to do here. Thanks.

Upvotes: 4

Views: 11383

Answers (3)

Mez
Mez

Reputation: 2857

Basically you need to create a second UIViewController subclass, this viewcontroller needs to be attached to your main window when switching views.

-(IBAction) SwitchView:(id)sender
{
MySubViewController *subViewController = [[MySubViewController] alloc]
                                         initWithNibName:@"SubView" bundle:nil];
self.view insertSubView:subViewController.view atIndex:0];
[subViewController release];
}

Upvotes: 2

Niels Castle
Niels Castle

Reputation: 8069

Yes, you need two view controllers.

Check out lesson 7 from Stanfords CS193P iPhone Application Programming course. It is available online. Both slides and the lecture through iTunes U.

CS193P iPhone Application Programming

I really enjoyed watching the course!

Upvotes: 2

Alex Reynolds
Alex Reynolds

Reputation: 96984

That is correct. You would have two view controllers: a "root" view controller that is the top-most view, and the second view controller that contains the editing form.

The second view controller would get pushed onto the navigation stack when you tap a cell.

Upvotes: 3

Related Questions