I have tried this:
In .h
file :
@interface TouchLabelViewController : UIViewController<UITextFieldDelegate>
@property (strong, nonatomic) IBOutlet UITextField *aTextField;
-(IBAction)hideKeyboard:(id)sender;
In .m
File :
-(IBAction)hideKeyboard:(id)sender{
[(UITextField*)sender resignFirstResponder];
}
And also tried this.
In .h
file :
- (void)viewDidLoad
{
[super viewDidLoad];
aTextField.delegate = self;
}
@property (strong, nonatomic) IBOutlet UITextField *aTextField;
-(BOOL) textFieldShouldReturn:(UITextField *)textField;
In .m
file:
-(BOOL) textFieldShouldReturn:(UITextField *)textField{
[aTextField resignFirstResponder];
return YES;
}
But still whenever I touch return key it does not hide keyboard.