★ TouchArcade needs your help. Click here to support us on Patreon.

resignFirstResponder for UITextView

07-10-2009, 08:42 AM
#1
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
resignFirstResponder for UITextView

Hey guys,
I was wondering if it was possible to implement a method which resigns the FirstResponder of the UITextView when you press the done button.
07-10-2009, 09:40 AM
#2
Joined: Apr 2009
Location: Munich
Posts: 384
Send a message via Skype™ to rdklein
yes of course:

just call the method when the button is pressed, link the uitextviewptr to the text view .

...
IBOutlet UITextView *uitextviewptr ;
@property (retain,nonatomic) IBOutlet UITextView *uitextviewptr ;

...
@synthesize uitextviewptr ;

-(IBAction) do_done: (id)sender
{
[uitextviewptr resignFirstResponder ];
}

RadioactivityCounter on App Store developer of this App RadioactivityCounter 2012
Ports of Call on App Store developer of this game 1986-2009,

07-10-2009, 09:56 AM
#3
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
Hmm, I'm pretty sure that method is for UIButtons. What I want is when you press the Done key on the keyboard.
07-10-2009, 10:09 AM
#4
Just connect the action to the DidEndOnExit Event and it should work fine xD

ngmoco:] PLUS+ Fu3lRac3r

My Blog: appstoreupdates.com
^^ Anyone want to write for my blog? Let me know
07-10-2009, 12:12 PM
#5
Joined: Apr 2009
Location: Munich
Posts: 384
Send a message via Skype™ to rdklein
And in this case you only need:


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

RadioactivityCounter on App Store developer of this App RadioactivityCounter 2012
Ports of Call on App Store developer of this game 1986-2009,
07-10-2009, 09:29 PM
#6
Joined: Nov 2008
Posts: 128
Quote:
Originally Posted by froggy1233 View Post
Hey guys,
I was wondering if it was possible to implement a method which resigns the FirstResponder of the UITextView when you press the done button.
can i ask why? text view is usually for multiline text and return key has a purpose to insert line breaks. if you are not doing multiline scrolling text you dont need a textVIEW.

and if you use uitextfield you can implement its delegate method for when the return key was pressed.
07-11-2009, 02:26 AM
#7
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
Okay, then does anyone know how to make a UITextfield extend itself as the text becomes longer like in the text application? I've seen a tutorial for it somewhere but can't seem to find it...