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-27-2011, 02:59 PM   #1 (permalink)
learning while doing
 
Moe2392's Avatar
 
Join Date: Aug 2011
Location: Ontario
Posts: 31
Moe2392 is on a distinguished road
Default Interact with app while it's running

I am trying to do things like calculate answers after taking user input. Lets say I have two empty textfields, you enter a number in each and it gives you your answer. I have the code that I want to run but this code runs right when the View loads and not again so all my numbers stay 0. If someone could tell me where to run code while my application is running or even give me a keyword so that I can search the topic. I've tried my e-books but none of them seem to have anything on it that I can find through a search. I tried a main method but that just created so many more problems. Thanks in advance.

This is the method I want to get to and use again and again

- (BOOL)textField:(UITextField *)TextFieldChecker shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {

NSString *comparison = [formulas objectForKey:NAME_KEY];

//read your text field value
double layFlatValue = [layFlat.text doubleValue];

//do whatever math you need to do, update your total label
if ([comparison isEqualToString:(@"Blow-Up Ratio (BUR)")]) {
blowUpRatio.text = [NSString stringWithFormat: @"%.4f", layFlatValue*0.637];
}

return YES;
}

Last edited by Moe2392; 08-27-2011 at 03:07 PM. Reason: Code
Moe2392 is offline   Reply With Quote
Old 08-27-2011, 04:27 PM   #2 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 25
rcirka is on a distinguished road
Default

That code snippet should work. Just make sure to set the delegate of your textfield to the controller and it will execute it whenever a character changes.
__________________
www.RonaldCirka.com
Equinox |TeamLiquid
Available for freelancing opportunities
rcirka is offline   Reply With Quote
Old 08-27-2011, 11:56 PM   #3 (permalink)
learning while doing
 
Moe2392's Avatar
 
Join Date: Aug 2011
Location: Ontario
Posts: 31
Moe2392 is on a distinguished road
Default

Setting the delegate; you're talking about right clicking and connecting to file owner from interface builder correct? Just connect them with the blue line or am I mistaken?
Moe2392 is offline   Reply With Quote
Old 08-28-2011, 11:36 AM   #4 (permalink)
learning while doing
 
Moe2392's Avatar
 
Join Date: Aug 2011
Location: Ontario
Posts: 31
Moe2392 is on a distinguished road
Default

YEP! I had forgotten to set the delegate. Thanks a lot rcirka!
Moe2392 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: 394
14 members and 380 guests
7twenty7, chiataytuday, cristofercolmbos, dedeys78, fiftysixty, gmarro, iOS.Lover, kilobytedump, Matrix23, raymng, ryantcb, stanny, UMAD, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

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