I have a textfield and a label.
When you touch the textfield, the keyboard appears
In IB, the textfield's properties are
Keyboard: ASCII Capable Return Key: Do开发者_运维知识库ne
I wired the IBOutlet to the label and the textfield.
How do I get the keyboard to go away when I'm done entering text. How do I get to copy the text to the UIlabel?
thanks
If you push the DONE Button, the UITextField
sends a -textFieldDidEndEdititing:
method to its delegate, which should be your controller instance.
This method simply moves the editor focus off the UITextField
and thus makes the keyboard disappear. Then put the new values into the UILabel
:
-(void)textFieldDidEndEditing:(UITextField *)textField {
[textField resignFirstResponder];
label.text = textField.text;
}
精彩评论