Multi-line TextField (similar to SMS) and / or 'Done' button in UITextView?

It's the same as tttexteditor, without the ugly glitches: hanspinckaers.com/multi-line-uitextview-....

Facebook has released an open-source package called Three20 that has a multi-line text field. You can use this pretty easily for an expanding text field. As for the "Done" button, you can set your view controller as a UITextFieldDelegate.

Then use this method: - (BOOL)textFieldShouldReturn:(UITextField *)textField { // Do whatever you want for your done button return YES; } In the case of Three20, use this method of TTTextEditorDelegate: - (BOOL)textFieldShouldReturn:(TTTextEditor *)textField { // Do whatever you want for your done button return YES; }.

.. UITextView does not have a textViewShouldReturn method even when set as the UITextViewDelegate, so that does not work. I am also loathe to use the Three20 stuff as I have read reports of multiple applications being rejected from the app store because of the private APIs that Three20 uses. – Anonymouslemming Jan 10 '10 at 11:18 The private API references have long since been removed from Three20 (see the change list from 17 November 2009).

As it was explained to me at the iPhone Tech Talk World Tour this past December, any code you end up not using gets stripped from release binaries anyway. See "Dead Code Stripping" in the Xcode Build System Guide (part of the iPhone OS Reference Library). – Joe D'Andrea Feb 1 '10 at 19:16.

Well, I had a similar problem, and what I ended up using is actually create a disabled UITextField as the background and a UITextView above it to get the input... It sucks that iPhone API cannot have this by default. Also note that this does not auto-expand, but you can do this if you want by handling the textViewDidChange: As for handling the return key, try implementing the following method from the UITextViewDelegate: - (void)textViewDidChange:(UITextView *)inTextView { NSString *text = inTextView. Text; if (text length > 0 && text characterAtIndex:text length -1 == '\n') { inTextView.

Text = text substringToIndex:text length -1; // remove last return from text view inTextView resignFirstResponder; // hide keyboard } }.

Thanks for the advice on the UITextViewDelegate, but that won't work I'm afraid. As I want to allow multi-line input, I cannot scan for '\n' - this is why I felt the behaviour of 'Go' and 'Done' both generating \n is unhelpful. – Anonymouslemming Jan 10 '10 at 19:40 Well, the suggested solution (one I'm also using) would be to add a "Done" button to a UINavigationBar as the UINavigationItem's rightBarButtonItem, and when it's clicked, just resignFirstResponder on your textview.

Or, basically, just add any other element of the UI to resign the responder. The navigation bar seems widely used, though. – Adam WoÅ› Jan 10 '10 at 19:42.

(void)textEditorDidBeginEditing:(TTTextEditor *)textEditor { And - (void)textEditorDidEndEditing:(TTTextEditor *)textEditor { might be what you're looking for. Enjoy!

CGSize size = CGSizeMake(_textField.frame.size. Frame = CGRectMake(0.0f, self.frame.size. Height - size.

CGRect r = _textField. Height = _inputBackgroundView.frame.size.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions