Transitioning to new view with button click

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

  1. macrumors newbie

    Joined:
    Dec 31, 2008
    #1
    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:

    Code:
    - (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

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    You're missing the sender parameter for your method. All IBActions need to be declared
    Code:
    - (IBAction) methodName:(id)sender
    or they won't get called via the IB connection.
     

Share This Page