Transitioning to new view with button click

Discussion in 'iOS Programming' started by ethayne, Feb 14, 2009.

  1. macrumors newbie

    Dec 31, 2008
    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?
  2. Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    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.

Share This Page