I m using -(void)textFieldDidBeginEditing:(UITextField *)sender this function in my application. this is not called when i select the textfield.
here's the code...
-(void)textFieldDidBeginEditing:(UITextField *)sender{  
    if([sender isEqual:txtName])//txtName is the IBOutlet of the UITextField  
    {  
        NSLog(@"Name");  
    }  
    else{  
        NSLog(@"NO_Name");  
    }  
}
Make sure to complete 2 simple steps
1 - Implement the delegate UITextFieldDelegate
@interface yourViewController : UIViewController <UITextFieldDelegate>
2 - Set the delegate
yourTextField.delegate = self
If you have many text fields in your view, you can set delegate for all of your text fields like this
for (id subView in self.view.subviews)
    {
        if ([subView isKindOfClass:[UITextField class]]) {
            [subView setDelegate:self];
        }
    }
Did you set delegate of UITextField's instance to current view controller like this:
textField.delegate = self; (self means the instance where callback textFieldDidBeginEditing is overridden)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With