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 12-08-2011, 11:29 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 17
jdunehew is on a distinguished road
Default Dismissing Keyboard with another button

I have a text field and a "go" button. I have it set to dismiss keyboard whenever user presses return and then run the action, however, I would also like to dismiss the keyboard if the user presses my go button also. Is there a way to do this?

Worst case I'll just remove the go button and have the user have to use the return key.

Thanks
jdunehew is offline   Reply With Quote
Old 12-08-2011, 11:42 PM   #2 (permalink)
New To iOS
 
Join Date: Nov 2011
Location: Waterloo, ON
Age: 20
Posts: 187
RileyE is on a distinguished road
Default

Quote:
Originally Posted by jdunehew View Post
I have a text field and a "go" button. I have it set to dismiss keyboard whenever user presses return and then run the action, however, I would also like to dismiss the keyboard if the user presses my go button also. Is there a way to do this?

Worst case I'll just remove the go button and have the user have to use the return key.

Thanks
Hi,

Before I respond, have you tried using google? I found this solution just two days ago in a couple minutes using google. If you can't find anything, I can help you with your search!
RileyE is offline   Reply With Quote
Old 12-09-2011, 12:20 AM   #3 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 17
jdunehew is on a distinguished road
Default

Quote:
Originally Posted by RileyE View Post
Hi,

Before I respond, have you tried using google? I found this solution just two days ago in a couple minutes using google. If you can't find anything, I can help you with your search!
I was on google a long time before I came here. I must be searching the wrong thing, I'm not sure what to look for.
jdunehew is offline   Reply With Quote
Old 12-09-2011, 12:27 AM   #4 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Get a reference to the textfield and call resignFirstResponder on it.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 12-09-2011, 12:51 AM   #5 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 17
jdunehew is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
Get a reference to the textfield and call resignFirstResponder on it.
I connected the did end on exit to the action where I resignFirstResponder and that takes care of removing the keyboard on the return key but I have another button I want to ALSO remove the keyboard. If you were telling me a different way to do it I don't understand what you are talking about. Could you please elaborate?

Thanks
jdunehew is offline   Reply With Quote
Old 12-09-2011, 12:54 AM   #6 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Yah, connect the button to a method that calls resignFirstResponder.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 12-09-2011, 01:05 AM   #7 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 17
jdunehew is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
Yah, connect the button to a method that calls resignFirstResponder.
That's what I did but it's not working for some reason. I just added the resignFirstResponder to my action that was already connected to my button.

-(IBAction)CmdBtnid)sender{
[sender resignFirstResponder];
[self CommandHandler:Input.text];
}

Advice on what I'm doing wrong?
jdunehew is offline   Reply With Quote
Old 12-09-2011, 01:07 AM   #8 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

No, you need to get a reference to your textfield and call resignFirstResponder on that. If "Input" is your textfield, you need to call the method on it.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 12-09-2011, 01:16 AM   #9 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 17
jdunehew is on a distinguished road
Default

Quote:
Originally Posted by Domele View Post
No, you need to get a reference to your textfield and call resignFirstResponder on that. If "Input" is your textfield, you need to call the method on it.
My problem is I don't fully understand the terminology you are using.

Do you mind telling me the steps to get this to work? Thanks for all the responses.
jdunehew is offline   Reply With Quote
Old 12-09-2011, 01:30 AM   #10 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Ok, I'm going to assume "Input" is your textfield. Call resignFirstResponder on "Input", like how you are currently calling CommandHandler on self. Also, you might want to look in coding conventions such as camelCase.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 12-09-2011, 01:31 AM   #11 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 17
jdunehew is on a distinguished road
Default

Quote:
Originally Posted by jdunehew View Post
My problem is I don't fully understand the terminology you are using.

Do you mind telling me the steps to get this to work? Thanks for all the responses.
Ugh.. I finally figured out what you are saying lol. Thanks for the help.
jdunehew is offline   Reply With Quote
Old 12-10-2011, 04:55 PM   #12 (permalink)
Registered Member
 
roher4's Avatar
 
Join Date: Jan 2011
Location: Toronto, Canada
Posts: 11
roher4 is on a distinguished road
Send a message via Skype™ to roher4
Default

Quote:
Originally Posted by jdunehew View Post
Ugh.. I finally figured out what you are saying lol. Thanks for the help.
Code:
-(IBAction)goPressed{
[textField resignFirstResponder];
}
roher4 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: 409
13 members and 396 guests
7twenty7, AppsBlogger, David-T, Duncan C, EvilElf, HemiMG, heshiming, iekei, LunarMoon, Murphy, sacha1996, Sami Gh, teebee74
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

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