Search code examples
iphoneobjective-ccocoa-touchuitextviewuitextfielddelegate

Function textFieldShouldBeginEditing is not called


I know that there are similar questions, but thiere answers didn't help me. I geuss I have some other bug.

I have a textView, I am setting it's delegate to self, but the relevant function is not called.

Here is the code:

In .h:

@interface MyViewController : UIViewController<UITextFieldDelegate>
@property (retain, nonatomic) IBOutlet UITextField *nameField;

In .m:

...
@synthesize nameField;
...
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    nameField.delegate = self;
...
}
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
    exitKeyboardButton.hidden = NO;
    return YES;
}

Solution

  • Eventually I used relevant IBAction functions. I you have a better idea, let me know, I will mark you answer.

    enter image description here