When I touch on a text field called tv_Name
, it brings up the keypad but then, when I touch outside the keypad, the program crashes.
In ViewController.h
, I have declared it thus:
@property (weak, nonatomic) IBOutlet UITextField *tv_Name;
and this is the code for hiding keypad in ViewController.m
:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.tv_Name resignFirstResponder];
}
The code immediately above throws an exception:
**2013-12-21 13:09:36.027 HerdProfile[818:70b] -[HerdProfileViewController tv_Name:]: unrecognized selector sent to instance 0x10901ce90 (lldb)**
The following seems to work ok for me.
ViewController.m
Are you sure you have your UITextField hooked up to your controller properly? There should be a little round dot beside your @property if it is connected properly (see screen grab)