Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 16, 2009, 04:00 PM   #1
eliavlevy
macrumors newbie
 
Join Date: Feb 2009
Keyboard does not disappear, even after textFieldShouldReturn

Hey guys,
I have a very simple application with a button and text field.
I want (of course) that when you click done after writing in the text field, the keyboard will go away. I added the following, as suggested in the Apple "First iPhone application" tutorial:

Code:
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
	if (theTextField == textField) {
		[textField resignFirstResponder];
	}
    return YES;
}
Although, it still doesn't seem to go away.

By the way, the text field is connected to the delegate, or the whatchamacallit.

Any help, please? Thanks.
eliavlevy is offline   0 Reply With Quote
Old Jun 16, 2009, 07:25 PM   #2
ghayenga
macrumors regular
 
Join Date: Jun 2008
Quote:
Originally Posted by eliavlevy View Post
Hey guys,
I have a very simple application with a button and text field.
I want (of course) that when you click done after writing in the text field, the keyboard will go away. I added the following, as suggested in the Apple "First iPhone application" tutorial:

Code:
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
	if (theTextField == textField) {
		[textField resignFirstResponder];
	}
    return YES;
}
Although, it still doesn't seem to go away.

By the way, the text field is connected to the delegate, or the whatchamacallit.

Any help, please? Thanks.
Have you designated your view controller a <UITextFieldDelegate> ?
ghayenga is offline   0 Reply With Quote
Old Jul 28, 2009, 11:21 AM   #3
funnylookinhat
macrumors newbie
 
Join Date: Jan 2009
I have the same problem - and I have both of these functions in my code:

Code:
- (void)textFieldDidEndEditing:(UITextField *)theTextField {
	[theTextField resignFirstResponder];
}

- (IBAction) doneButtonOnKeyboardPressed:(id)sender {  
}
And yeah, here is my Controller class definition line - or whatever it's called... :-)

Code:
@interface WmMobileViewController : UIViewController <UINavigationControllerDelegate,UITextFieldDelegate,UIImagePickerControllerDelegate,MyCLControllerDelegate>
I'm totally baffled as to why the keyboard won't dissapear when they click "Done" with these functions, let alone by default (good one Apple). ;-)

You'd think that the natural behavior would be to hide the keyboard and that they would just leave it to developers to override it if they wanted to.
funnylookinhat is offline   0 Reply With Quote
Old Mar 3, 2010, 08:34 PM   #4
montalat
macrumors newbie
 
Join Date: Mar 2010
open the
MyViewController.xib
click on the TextField
open the Connections Inspector or do :Tools , Connections Inspector
slide the delegate button to File's Owner in the MyViexController .xib window
That s all save all and it work
Be well
http://cdn.macrumors.com/vb/images/smilies/smile.gif
montalat is offline   0 Reply With Quote
Old Mar 4, 2010, 12:25 PM   #5
KoolStar
macrumors Demi-God
 
KoolStar's Avatar
 
Join Date: Oct 2006
Location: Kentucky
Send a message via AIM to KoolStar Send a message via Skype™ to KoolStar
Quote:
Originally Posted by montalat View Post
open the
MyViewController.xib
click on the TextField
open the Connections Inspector or do :Tools , Connections Inspector
slide the delegate button to File's Owner in the MyViexController .xib window
That s all save all and it work
Be well
http://cdn.macrumors.com/vb/images/smilies/smile.gif
That is correct or if your doing the interface in code, you can use the line
Code:
self.TEXTFIELDNAME.delegate = self;
__________________
"Innovation distinguishes between a leader and a follower." : S.J.
KoolStar is offline   0 Reply With Quote
Old Jul 11, 2010, 12:50 AM   #6
jcpennypincher
macrumors newbie
 
Join Date: Jul 2010
Thanks Montalat

Thank you very much that solved it
jcpennypincher is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How to disappear completely appleperson1 OS X Mavericks (10.9) 10 Dec 19, 2013 10:57 AM
I wish it WOULD just disappear... Bobby dazzler Wasteland 4 Nov 18, 2013 02:46 PM
Cursor disappear riklar iMac 1 Oct 20, 2013 10:19 AM
Icons that disappear bakura OS X 10.8 Mountain Lion 0 Sep 19, 2012 12:35 PM
Did Local Backups Disappear in ML? Winter Charm OS X 10.8 Mountain Lion 2 Jul 26, 2012 07:59 AM

Forum Jump

All times are GMT -5. The time now is 11:45 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC