PDA

View Full Version : Transitioning to new view with button click




ethayne
Feb 14, 2009, 02:25 PM
Hello all,

I've got an app here with two views and the code to transition from the first to the second. However, the code is placed inside a method (IBAction) for the click of a button and, upon running the app, the click does not trigger anything... Here is my button-click method:

- (IBAction) instructionsWasPressed {
if(self.instructions == nil) {
InstructionsScreenViewController *instructionsScreen = [[InstructionsScreenViewController alloc] initWithNibName:@"InstructionsScreen" bundle:nil];
self.instructions = instructionsScreen;
[instructions release];
}

[self.navigationController pushViewController:self.instructions animated:YES];
}


"instructions" is an InstructionsScreenViewController declared in the header file.

What am I missing?



dejo
Feb 15, 2009, 12:27 PM
What am I missing?
You're missing the sender parameter for your method. All IBActions need to be declared
- (IBAction) methodName:(id)sender
or they won't get called via the IB connection.