Problems making keyboard vanish (resignFirstResponder)
I was following the Apple Developer Connection's instructions on creating an iPhone app (the with the text field, label, and button, where clicking the button makes the label display the entry in the text field).
I can't get the keyboard to disappear at all, not when tapping outside of the text field, not when tapping the button, and not when tapping "Return/Go/etc." on the bottom right of the keyboard.
<pre>
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
if (theTextField == textField) {
[textField resignFirstResponder];
}
return YES;
}
</pre>
In Interface Builder, when I look at the text field attributes for that text field, under "Text Input Traits", I have "Return Key" as default. I would like either one of two behaviors - either make the button perform the same function as the button, and vanish afterward; or have a button that makes the keyboard simply vanish.
Any ideas what I might be doing incorrectly?
I can't get the keyboard to disappear at all, not when tapping outside of the text field, not when tapping the button, and not when tapping "Return/Go/etc." on the bottom right of the keyboard.
<pre>
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
if (theTextField == textField) {
[textField resignFirstResponder];
}
return YES;
}
</pre>
In Interface Builder, when I look at the text field attributes for that text field, under "Text Input Traits", I have "Return Key" as default. I would like either one of two behaviors - either make the button perform the same function as the button, and vanish afterward; or have a button that makes the keyboard simply vanish.
Any ideas what I might be doing incorrectly?
Macbook Pro (silver), Mac OS X (10.5.7)