Use this textFieldShouldReturn: method and add the UITextFieldDelegate delegate to yourClass.h. set the delegate to yourTextfield and write the following code in the viewDidLoad method.
yourTextfield.delegate = self;
and also implement textFieldShouldReturn: as follows:
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField { [theTextField resignFirstResponder]; return YES; }
I think it will be useful for you.
Prasad g
source share