Reputation: 427
In my view controller i added a text field as below.
txt1 = [[UITextField alloc]initWithFrame:CGRectMake(10, 10, 70, 20)];
txt1.delegate = self;
txt1.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:txt1];
[txt1 release];
I set UITextFieldDelegate
in .h
file. I write
-(BOOL)textFieldShouldReturn:(UITextField *)textField
to dissmiss my keyboard.But it not firing delegate method. Any help!!! Thanks in advance.
Upvotes: 0
Views: 99
Reputation: 14094
Have you tried sending the resignFirstResponder
message?
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
}
Upvotes: 1