J. Doe J. Doe - 1 year ago 125
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;


and .m

@implementation ViewController
@synthesize testItHere;
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField;
return YES

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

[self updateTestKeyboard:self.interfaceOrientation];

- (void)viewDidLoad {
[super viewDidLoad];


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

Answer Source

Remove the dot:

[self.testItHere resignFirstResponder];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download