Background tap not working

Discussion in 'iOS Programming' started by THEDEAN911, Feb 13, 2010.

  1. THEDEAN911 macrumors newbie

    Joined:
    Feb 13, 2010
    #1
    Hi

    I'm trying to have the number pad retract after the background it is tapped.

    This is my ViewController.h

    Code:
    #import <UIKit/UIKit.h>
    
    @interface control_funViewController : UIViewController {
    
    	UITextField *nameField;
    	UITextField *numberField;
    }
    
    @property (nonatomic, retain) IBOutlet UITextField *nameField;
    @property (nonatomic, retain) IBOutlet UITextField *numberField;
    
    - (IBAction)textFieldDoneEditing:(id)sender;	
    - (IBAction)backgroundTap:(id)sender;
    
    and this is my ViewController.m

    Code:
    #import "control_funViewController.h"
    
    @implementation control_funViewController
    @synthesize nameField;
    @synthesize numberField;
    
    
    - (IBAction)textFieldDoneEditing:(id)sender{
    	[sender resignFirstResponder];
    }	
    - (IBAction)backgroundTap:(id)sender {
    	[nameField resignFirstResponder];
    	[numberField resignFirstResponder];
    }
    
    - (void)dealloc {
    	[nameField release];
    	[numberField release];
        [super dealloc];
    }
    
    @end

    I set the background to UIControl in interface builder and linked it from Touch down to File's Owner.

    Any help appreciated :)

    Thanks
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Did you make sure to also link nameField and numberField?
     
  3. THEDEAN911 thread starter macrumors newbie

    Joined:
    Feb 13, 2010

Share This Page