How to close keyboard when finished typing on iPhone
<p>I have been sourcing for codes/tutorials on iPhone UITextField. I came across its sample code on how to use API commands for it. I then created my TextFields programmatically, and now I cant close the keyboard when I press Done. I know the command is resignFirstResponder. But when and how do I use it?</p>

<p>Here is what I did.</p>

<p>textField = [[UITextField alloc] initWithFrame:CGRectMake(yView, xView, 100, 25)];</p>

<p>textField.borderStyle = UITextBorderStyleRoundedRect;</p>

<p>textField.clearButtonMode = UITextFieldViewModeWhileEditing;</p>

<p>textField.returnKeyType = UIReturnKeyDone;</p>

<p>[textField setText:(@"test")];</p>

<p>[self addSubview:textField];</p>

<p>Now, where do I put the resignFirstResponder? The sample code did it by using a viewController. I did mine in a view. I hope it is possible to be done on a view. </p>

<p>Thanks.</p>
