title: How to make the keyboard disappear after clicking return button
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/6190276/how-to-make-return-key-on-iphone-make-keyboard-disappear">How to make return key on iphone make keyboard disappear?</a>  </p>
  </blockquote>
  
  
  
  <p>I have two text fields in the page I'm working on. Only the first text field disappears after I click return, yet it doesn't work for the second text field.</p>
  
  <p>Here are the methods in my .m file:</p>
  
  <pre><code>-(void) viewWillAppear:(BOOL)animated
  {
      [super viewWillAppear:animated]; 
      self.cardNameTextField.delegate = self;    
      self.pinTextField.delegate = self;
  }
  
  -(BOOL) textFieldShouldReturn:(UITextField *)textField
  {    
      if (_cardNameTextField !=nil)
      {
          [self.cardNameTextField resignFirstResponder];
      }
      else if (_pinTextField !=nil)
      {      
          [self.pinTextField resignFirstResponder];
      } 
      return YES;
  }
  </code></pre>
  
  <p>Advice please :)</p>