Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-31-2009, 10:19 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 48
Default How to define textField's textFieldShouldReturn from View

I'm creating an application that uses one overall ViewController. It has one view and that one view has a number of subviews. There is no NavigationController.

In a couple of subviews, there are textfields. When a particular subview is brought to the front, I'd like the first textfield in that subview become the First Responder and, when the user is done, for it to relinquish that status.

I tried just adding the <UITextFieldDelegate> interface to the View but it seems to be ignoring the textFieldShouldReturn method when I press Done on the keyboard.

Am I missing something?

Thanks!

Last edited by cybohemia; 01-31-2009 at 10:32 PM.
cybohemia is offline   Reply With Quote
Old 01-31-2009, 10:50 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 48
Default

Ah - I figured it out.

In case anyone's interested, I just needed to define everything (that is, the textfield properties) from the top ViewController through the views...

I guess that is sort of obvious now that I think about it although I'm not sure why it eluded me for forty-five minutes...
cybohemia is offline   Reply With Quote
Old 03-16-2009, 06:36 PM   #3 (permalink)
New Member
 
Join Date: Feb 2009
Posts: 4
Default

Quote:
Originally Posted by cybohemia View Post
Ah - I figured it out.

In case anyone's interested, I just needed to define everything (that is, the textfield properties) from the top ViewController through the views...

I guess that is sort of obvious now that I think about it although I'm not sure why it eluded me for forty-five minutes...

Adding <UITextFieldDelegate> makes the keyboard pop up automatically? If this does work, can you post the code for this section?

Thanks!
hondo is offline   Reply With Quote
Old 03-16-2009, 06:52 PM   #4 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

No, adding <UITextFieldDelegate> to a class definition simple states that the class conforms to the UITextFieldDelegate protocol. It does nothing to make the keyboard appear.
RickMaddy is offline   Reply With Quote
Old 03-16-2009, 06:57 PM   #5 (permalink)
Tutorial Author
 
Join Date: Jan 2009
Posts: 144
Default

just call
Code:
[referenceToTextView becomeFirstResponder];
meowmix23F is offline   Reply With Quote
Reply

Bookmarks

Tags
first responder, navigationcontroller, subview, textfield, viewcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 255
19 members and 236 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, Dani77, DarkAn, Desert Diva, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, ryantcb, Speed, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:46 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0