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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 07-08-2010, 06:44 AM   #1 (permalink)
Registered Member
 
K2mia's Avatar
 
Join Date: Jun 2010
Posts: 29
K2mia is on a distinguished road
Default UITextField - any way to keep keyboard?

I have been searching on these forums and googling, as well as consulting the documentation but cannot seem to find an answer.

How can I make it so the popup keyboard stays on screen?

Thanks,
Andy
K2mia is offline   Reply With Quote
Old 07-08-2010, 09:06 AM   #2 (permalink)
Registered Member
 
K2mia's Avatar
 
Join Date: Jun 2010
Posts: 29
K2mia is on a distinguished road
Default

I figured out how to do this and wanted to post it here in case anyone else has the same question.

First, make sure to set the controller as the UITextField's delegate in your .h file ( make sure the controller uses the UITextFieldDelegate protocol ).

Code:
@interface YourViewController : UIViewController <UITextFieldDelegate>
Then in the .m file set the delegate, I do this in viewDidLoad:

Code:
textfield.delegate = self;
Finally override the textFieldShouldReturn method, you want it to do whatever you need done when input is entered but it should return NO to prevent the textfield from resigning first responder status. My example clears the textfield, calls a method that will process the new input and then returns NO:

Code:
- (BOOL)textFieldShouldReturn:(UITextField *)tf{
	[self processInput:tf];
	[tf setText:@""];
	return NO;
}
Thats it, keyboard stays up once the textfield becomes first responder...

-Andy
K2mia is offline   Reply With Quote
Reply

Bookmarks

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: 343
14 members and 329 guests
akacaj, c2matrix, cgokey, esoteric, EXOPTENDAELAX, GHuebner, givensur, HemiMG, Mirotion22, mjnafjke, Pudding, SLIC, Sloshmonster, Sonuye857
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,652
Threads: 94,115
Posts: 402,887
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Sonuye857
Powered by vBadvanced CMPS v3.1.0

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