I can not hide keyboard by pressing return key

Posted by chetan on Stack Overflow See other posts from Stack Overflow or by chetan
Published on 2012-10-29T04:53:14Z Indexed on 2012/10/29 5:00 UTC
Read the original article Hit count: 100

Filed under:
|
|

I have tried this:

In .h file

 @interface TouchLabelViewController : UIViewController<UITextFieldDelegate>
    -(IBAction)hideKeyboard:(id)sender;

In .m File

-(IBAction)hideKeyboard:(id)sender{
    [(UITextField*)sender resignFirstResponder];
}

And also tried this

in .h file

-(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.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about ios