Tuesday, September 24, 2013

Iphone hidden in the realization of the virtual keyboard

Original problem comes from CSDN Q channels, additional solutions see http://ask.csdn.net/questions/ 43

Original problem:
How to hide the keyboard in iphone?
There are two uiTextFields, but pressed the return key after the keyboard can not be hidden.
I do not know how to do

View or ViewController in your beginning to set UITextFieldDelegate protocol:
 @ interface YourViewController: UIViewController  

Then in the. M file, add UITextFieldDelegate Protocol Method:
 - (BOOL) textFieldShouldReturn: (UITextField *) textField {[textField resignFirstResponder]; return YES;} 

Finally, the initialization. M files in the textfield after,
 yourTextField = [[UITextField alloc] initWithFrame: yourFrame]; 

The next line is very important
 yourTextField.delegate = self; / / viewcontroller or view associated with the textField 


Reply:
E Road route X10 brush machine software
Reply:
[YourTextField resignFirstResponder] try

No comments:

Post a Comment