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 04-21-2008, 02:59 PM   #1 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 93
BuschyBoy is an unknown quantity at this point
Default Drop keyboard down with touch somewhere else?

When I have a UITextField and the keyboard comes up, I'd like to be able to get rid of the keyboard, either by using the "Done" key you sometimes see or by touching somewhere else. Anyone know how you would do this?

Thanks!
BuschyBoy is offline   Reply With Quote
Old 04-21-2008, 04:41 PM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Location: Lexington, KY
Posts: 108
Fastrak is an unknown quantity at this point
Default Re: Drop keyboard down with touch somewhere else?

OK This one was tricky!

You need to add <UITextFieldDelegate>
to you declaration in the header file (so you can get called by by the text keyboard events

THEN

phoneNumber = [[UITextField alloc] initWithFrame:CGRectMake(100,100,100,30)];
[phoneNumber setText:@"859-555-1212"];
phoneNumber.delegate = self;

[self addSubviewhoneNumber];

//adding this method will allow you to check for touches

- (void)touchesBeganNSSet *)touches withEventUIEvent *)event
{
if (![touches containsObjecthoneNumber])
{
[phoneNumber resignFirstResponder];
}
}


// Sent when the return key on the keyboard is touched
- (BOOL)textFieldShouldReturnUITextField *)theTextField
{
[theTextField resignFirstResponder];
return YES;
}
Fastrak is offline   Reply With Quote
Old 04-21-2008, 05:08 PM   #3 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 93
BuschyBoy is an unknown quantity at this point
Default Re: Drop keyboard down with touch somewhere else?

Ah, I didn't think of that! Awesome!
BuschyBoy 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
UITextView keyboard Fastrak iPhone SDK Development 19 03-09-2012 07:00 AM
Supress keyboard on text field touch jonc iPhone SDK Development 6 05-26-2009 07:44 PM
Activity Screen on top of keyboard? javid.alimohideen iPhone SDK Development 7 01-15-2009 03:18 AM
Keyboard hides text field - how do I fix this? pendraggon87 iPhone SDK Development 10 07-03-2008 07:43 AM
UIWebView keyboard Fastrak iPhone SDK Development 1 06-19-2008 04:21 PM


» Advertisements
» Online Users: 393
14 members and 379 guests
13dario13, 7twenty7, buggen, EvilElf, glenn_sayers, j.b.rajesh@gmail.com, LunarMoon, morterbaher, n00b, QuantumDoja, sacha1996, Sami Gh, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,673
Threads: 94,122
Posts: 402,906
Top Poster: BrianSlick (7,990)
Welcome to our newest member, morterbaher
Powered by vBadvanced CMPS v3.1.0

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