Spike Lee
Spike Lee

Reputation: 411

pushViewController iphone not working

i am unable to get the pushViewController to work on a View Based Application on the iPhone. On my 'ProjectViewController' i have a IBAction with the following code :

-(IBAction)switchAugmented
{
    ARViewController *viewController = [[ARViewController alloc] initWithDelegate:self];
    [self.navigationController pushViewController:viewController animated:YES];
    [viewController release];
}

When i run the program and press ibaction nothing happens. Besides that statement above do i need to do anything else to make the view appear? what am i missing?

Upvotes: 0

Views: 1197

Answers (3)

denil
denil

Reputation: 690

You won't be able to push a new view controller in a View Based Project. You need to create a Navigation Based Project or add an instance of the UINavigationController in your Main.nib (if your using a nib file) only then will the push view controller will work

Upvotes: 0

akashivskyy
akashivskyy

Reputation: 45210

(...) on a View Based Application (...)

You just have no UINavController! Try to embed your main view in UINavigationController and everything will start working.

Upvotes: 1

ms83
ms83

Reputation: 1814

Double check to make sure that the button you are pressing is connected to the right method in interface builder. Also try putting an NSLog statement in the switchAugmented to see if the method is getting called.

You also have to check and see if you have a UINavigationController instance, otherwise you won't be able to push a new view controller.

Upvotes: 0

Related Questions