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 08-17-2010, 12:57 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 196
phillipie99 is on a distinguished road
Default Checking for text in a textfeild

I need a way to check and see if a textfeild infact contains text i am using this line of code to see if it dosent
Code:
if (goalie1Name.text==nil) {
//do stuff
}
and it is working fine but I also need to see if it contains text so I can allow the keyboard to disappear. I am calling these from the textfield should return ** update not working fine the if method only seems to get called once the next tome the text feild is opened it is never called

Last edited by phillipie99; 08-17-2010 at 01:00 AM.
phillipie99 is offline   Reply With Quote
Old 08-17-2010, 01:33 AM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 577
Speed is on a distinguished road
Default

Can't you just put this statement after and if it doesn't return nil, it will just call else?

Code:
if (myTextField == nil) {
//DO STUFF
}

else {

//TextField has stuff in it, so put the other code here.

}
Speed is offline   Reply With Quote
Old 08-17-2010, 04:04 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2010
Location: Enschede, Netherlands
Posts: 198
rickrets is on a distinguished road
Default

create in the .m:
Code:
- (void)textCheck{
//your code
}
in the .h:
Code:
- (void)textCheck;
Then inside IB, select the textfield, drag a line from:
- Editing Changed
- Editing Did Begin
- Editing Did End

To File's Owner and select textCheck, now the function gets called every time.
rickrets is offline   Reply With Quote
Old 08-17-2010, 08:21 AM   #4 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 178
dustbyter is on a distinguished road
Default

You can always use this to check if something is typed in the textfield

Code:
if (myTextField.text.length > 0)
  // data in text field
else
  // no data in text field
dustbyter 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: 361
5 members and 356 guests
freewind, givensur, linkmx, Newbie123, PlutoPrime
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,894
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

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