J. Doe J. Doe - 29 days ago 15
iOS Question

resignFirstResponder expected identifier

I want to hide keyboard if user press return key!
here .h file

#import <UIKit/UIKit.h>


@interface ViewController : UIViewController <UITextFieldDelegate>;


@property (weak, nonatomic) IBOutlet UITextField *testItHere;

@end


and .m

@implementation ViewController
@synthesize testItHere;
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField;
{
[self.testItHere.resignFirstResponder]
return YES
}

- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];

[self updateTestKeyboard:self.interfaceOrientation];
}

- (void)viewDidLoad {
[super viewDidLoad];

self.testItHere.delegate=self;
}


But error says:expected identifier, what is wrong with this code?

Answer

Remove the dot:

[self.testItHere resignFirstResponder];
Comments