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 08-25-2009, 05:17 AM   #1 (permalink)
Registered Member
 
chuck's Avatar
 
Join Date: Aug 2008
Location: Berlin, Germany
Posts: 87
Default activate return key on keyboard when UITextField is empty?

I currently have an address form where a user has to enter Street Line 1 (required) and then advances to Street Line 2 (optional). The problem is that if nothing is entered in this field, the Next button is disabled. Is there any way to enable the return key on the keyboard when nothing is entered in its text field?
__________________
German Course: Learn German anywhere! Chess Player: Study Chess anywhere!
chuck is offline   Reply With Quote
Old 08-25-2009, 10:46 AM   #2 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 60
Default

Quote:
Originally Posted by chuck View Post
I currently have an address form where a user has to enter Street Line 1 (required) and then advances to Street Line 2 (optional). The problem is that if nothing is entered in this field, the Next button is disabled. Is there any way to enable the return key on the keyboard when nothing is entered in its text field?
I haven't tryed it but I'm sure you could check with an IF string is @"" kinda thing and maybe have a read through this: Removing Keyboard when done
__________________
JeromeC is offline   Reply With Quote
Old 08-26-2009, 07:07 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 216
Default

To dissmiss the keyboard without the return key, you could :

Code:
(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

   if (theTextField.editing == YES) {

           [theTextField resignFirstResponder];

   }

}
By the way, I wrote from my memory so there might be an error in spelling or something but o hope you get the idea
johnathon is offline   Reply With Quote
Old 11-11-2009, 10:01 AM   #4 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 3
Default

Make sure that your header interface invokes <UITextViewDelegate>
Code:
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range 
 replacementText:(NSString *)text
{
	if([text ...){
               textView.text = ...
        }
	return NO;
}
You can use the Range information too.
jdpmdphd is offline   Reply With Quote
Old 01-10-2010, 04:22 PM   #5 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 33
Default

I guess you use IB. Uncheck auto-enable return key - that's all.
__________________
Available On App Store
ztory666 is offline   Reply With Quote
Reply

Bookmarks

Tags
empty, keyboard, return, text field, uitextfield

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: 263
16 members and 247 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, Dani77, DarkAn, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, Speed
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:51 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0