Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

drivefast

macrumors regular
Original poster
Mar 13, 2008
128
0
is there any IB combination of settings that i can have for an UITextField (or something similar for that matter), that would make the keyboard disappear when the return, done or whatever button is pressed? i know how to do it with resignFirstResponder, but i have a feeling that there's got to be something easier than that. thanks.
 
To make the keyboard retract, I usually do 2 things:

1. Make a big button that takes up the entire view. Set the button type to custom, and send it to the back of the layout. Then connect the "Touch Up Inside" event to an action method that calls resignFirstResponder on the sender.

2. Connect the "Did finish on Exit" event (I think that's what it's called, I'm not looking at it right now, but it's the top-most event in the Connections inspector), to an action method that calls resignFirstResponder on the sender (can be the same method as above). This will cause the keyboard to retract when the "Done" key is pressed (provided that you have set the return key type to Done).

Hope that helps.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.