title: Delegate for UITextField not working...Return button not responding
body: <p>I've just started with xcode and objective-c and did some very basic apps, but what i'm having problem with is very basic this. the keyboard return button not hiding the keyboard.</p>
  
  <p>I've searched the internet for the solution and all they say is to connect delegate to the file's owner and add the function and it should work, i did that and nothing is working.</p>
  
  <p>I have an ok button and it is working and also clicking on any free space on the screen is working, just the return button....</p>
  
  <p>I am using the simulator, not testing on iphone yet. (xcode 3.2.5 64 bit with the 4.2 simulator).</p>
  
  <p>This is the line of code that should connect the delegate to every textFiled.
  1. i've tried already to return both <code>YES</code> and <code>NO</code>, didn't work.
  2. i've tried both a specific object name for the textField and this general way, didn't work.</p>
  
  <pre><code>- (BOOL)textFieldShouldReturn:(UITextField *)textField {
  [textField resignFirstResponder];
  return NO;
  }
  </code></pre>
  
  <p>In the: basic view controller connection -> connections -> outlets, i have the: delegate -- File's Owner. and in the file's owner in referencing outlets there is: delegate - Round style text.....</p>
  
  <p><strong>EDIT - i forgot to mention before, i've check and the method isn't being called!!!</strong></p>
  
  <pre><code>- (BOOL)textFieldShouldReturn:(UITextField *)textField{
  NSLog(@"Working!!!");
  [textField resignFirstResponder];
  return YES;
  </code></pre>
  
  <p>}</p>
  
  <p>what should i do to make it happen? that is why people say to connect the delegate, but in my case it is connected and not triggering the function...i know it is kind of dumb question but for a nobie like me the solution is not obvious...</p>
  
  <p><strong>OK, another Edit - with all my code: just can't understand what to do....</strong>
  This is: <code>basicViewController.h</code>:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface basicViewController : &lt;#superclass#&gt; &lt;UITextFieldDelegate&gt;
  
  @interface basicViewController : UIViewController &lt;UITextFieldDelegate&gt; {
  //every object that we want to interact with (like text field or lable) is call an   outlet!!!!
  //here we define the outlets for our program
  IBOutlet UITextField *txtName;
  IBOutlet UILabel *lblMessage;
   }
  
  //here are the getters and setter for our outlets
  @property (nonatomic, retain) IBOutlet UITextField *txtName;
  @property (nonatomic, retain) IBOutlet UILabel *lblMessage;
  
  //method decleration for the OK button action
  - (IBAction) doSomething;
  
  
  
  //method for hiding the keyboard when clicking on empty area in the app
     //we will put an invisible button on all area and clicking on it will make keyboard disapear
     - (IBAction) makeKeyboardGoAway;
  
     @end
  </code></pre>
  
  <p>This is <code>basicViewController.m</code>:</p>
  
  <pre><code> #import "basicViewController.h"
  
   @implementation basicViewController
  
   //synthesizeing the objects that we made' this will create the getter and setters automaticly
   @synthesize txtName;
   @synthesize lblMessage;
  
   - (IBAction) doSomething{
  // makeing keyboard disapear when pressing ok button (doing that form the text field)
  //when pressing the OK button, the keyboard will disapear and when clicking in the text field it will show again
  [txtName resignFirstResponder];
  
  
  
  NSString *msg = [[NSString alloc] initWithFormat:@"Hello, %@",txtName.text];
  
  //the objective-c way for setting the test in the text field
  [lblMessage setText:msg];   
  //the regular object oriented way
  //lblMessage.text = msg;
  [msg  release];
   }    
  
   - (IBAction) makeKeyboardGoAway{
  [txtName resignFirstResponder];
   } 
  
   //when clicking the return button in the keybaord
   - (BOOL)textFieldShouldReturn:(UITextField *)textField{
  NSLog(@"Working!!!");
  [textField resignFirstResponder];
  return YES;
   }
  
  
   - (void)didReceiveMemoryWarning {
  // Releases the view if it doesn't have a superview.
      [super didReceiveMemoryWarning];
  
  // Release any cached data, images, etc that aren't in use.
   }
  
   - (void)viewDidUnload {
  // Release any retained subviews of the main view.
  // e.g. self.myOutlet = nil;
   }
  
  
   - (void)dealloc {
       [super dealloc];
   }
  
   @end
  </code></pre>
  
  <p>Maybe now i am more clear, sorry i didn't do it before.
  Any one has an idea what am i doing wrong? it should be pretty strait forward.....</p>
  
  <p><strong>EDIT - Adding an image of all the elements, i hope that will help to help me :-)</strong>
  <img src="https://i.stack.imgur.com/GqD6j.jpg" alt="alt text"></p>
  
  <p>10x a lot for every one that is trying to help....i really like this framework, it is so great after c++ and java, python and many other...and i am working with a book, but it is for ios 3.1, maybe that is the problem.....</p>