views:

166

answers:

2

i am building up a view-based project with out a navigation bar. I have 2 pages. Simply need a button to link from page one to page two. Then a button to link from page two to page one. Seems it should be very simple but i am having a heck of a time trying to get it.

A: 
- (IBAction) view2ButtonPressed: (id) sender {
    View2Controller *vc = [[View2Controller alloc] initWithNibName:@"View2" bundle:nil];
    [self.navigationController pushViewController:vc animated:YES];
}

Then link the touchedUp action of your button to the view2ButtonPressed method. (Make sure you list the method in your .h file as well)

John
Don't forget to `[vc release]` after it's pushed to the nav controller or you'll leak memory.
Daniel Dickison
A: 

I am obviously missing something stupid here. I have my buttons there and and everything lined up that i can think of, pressing the button simply will not go to the next page. I uploaded my project that just consists of the 2 buttons and 2 pages. Could someone check it out and point out what i am still missing?

files.me.com/bolinger/yvyf3a

thanks so much for the help!

I'll take a look tomorrow, but one quick thought - make sure you have a navigation controller to accept the pushViewController message.
John