To programatically hide the keyboard you must call the method resignFirstResponder on your text field or text view. This can be called from anywhere however it is most commonly from a done button or from the keyboard return key being pressed.
[textField resignFirstResponder];
To hide the keyboard when the return key is pressed you must add a listener to the text field (UITextField) delegate method. UITextfieldDelegate protocol contains a method called textFieldShouldReturn, This method is called to determine if the text field should process the pressing of the return key. You can call your resignFirstResponder on the text field from within this method to hide the keyboard when pressed.
- (
BOOL
)textFieldShouldReturn:(
UITextField
*)textField {
[textField
resignFirstResponder
];
}
If this doesn't appear to be working for you make sure you've remembered to set the delegate property on the textField.
If you have any problems feel free to post in the comment's ;)
If my component is a Multiline TextField? The Return button would take the keyboard off istead break the line?
ReplyDeleteHello,
ReplyDeleteThey have experienced game developers who know each and every tricks and tweaks of the game development market.
Hire iphone Developer
I have recently started Iphone Application Developmentt and this is really a new concept for me. I have understood the code and now trying to implement this in my project.
ReplyDeleteiPhone Development
ReplyDeletehas become very important for the companies working on various mobile development platforms. With the iPhone SDK available, mobile developers can now build new apps and also customize the existing ones.
READ MORE http://texnikal.ru
ReplyDeleteHey, I created a view controller which does everything automatically. Have a look here: http://www.iosissues.com/2012/12/how-to-hide-keyboard-when-return-button.html
ReplyDeleteGreat idea !
ReplyDeleteusing web technologies is not "easy" you can get errors and problems however the advantages of using web technologies to create your gaming website outweigh the cons.
iphone apps development
Iphone Development has brought a revolution in mobile computing. There is no doubt that any company not thinking about developing their apps related to its industry will not be left behind.
ReplyDeleteGreat article.I like your thoughts and it's really great.Great discussion.Thanks for sharing.
ReplyDelete--------------------------------------------------------------------------------------------------------------
iPhone App Development
It is really a great work and the way you sharing the knowledge is excellent.
ReplyDeleteAs a beginner in iPhone App Development your post is very help full. Thanks for your informative article. If you guys interested to learn iPhone App Development.
iPhone app development perth
Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
ReplyDeletebest ios training institute
ios training institute
ios training institute in hyderabad
Much obliged for sharing this great substance. it's exceptionally helpful to us. I acquired a ton of data, the manner in which you have obviously clarified is truly phenomenal. You rock for this blog.
ReplyDeleteEmpower your Business with ReactJS Development