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

MythicFrost

macrumors 68040
Original poster
Mar 11, 2009
3,940
38
Australia
I assume I have to tell it what the Return button does in the keyboard after you've selected my text field and typed your message, how do I do that?

Thanks
 

KoolStar

macrumors demi-god
Oct 16, 2006
825
9
Kentucky
You need to implement the UITextDelegate and the resign the first responder on the return button press.
 

mandude

macrumors member
Nov 19, 2009
64
0
hey all you gotta do is this : )


h.file:

Code:
@interface..... {

   UITextField *textField;
}
@property (nonatomic, retain) IBOutlet UITextField *textField;
-(IBAction)textFieldDoneEditing:(id)sender;
//* this is for if you would like the keyboard to disappear from touching the background :
-(IBAction)backgroundTap:(id)sender;


in interface builder connect that to the text field of your choice, and use DID END ON EXIT if you chjoose to use the backGroundTap method, in the main window, click on the gray box named VIEW click on the inspector, and click the 4th tab, or press COMMAND 4 then at the topo change the class from UIView to UIControl then go to the connections and drag the TOUCH DOWN to the Files Owner and select BackgroundTap


m. file:

Code:
-(IBAction)textFieldDoneEditing:(id)sender {
[sender resignFirstResponder];
}

-(IBAction)backgroundTap:(id)sender {
[textField resignFirstResponder];
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.