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

View Single Post
Old 02-13-2010, 07:07 AM   #1 (permalink)
@@rz
Registered Member
 
Join Date: Feb 2010
Posts: 12
@@rz is on a distinguished road
Default Sum data from several textfields to a label

I'm trying to sum the integers from five UITextFields and post them to a UILabel.

This is the code I have tried. It works to begin with, then it start to mess up! Sometimes it doesent work at all!! Really weird!

int val = [textfield1.text intValue]
val = val+[textfield2.text intValue];
val = val+[textfield3.text intValue];
val = val+[textfield4.text intValue];
val = val+[textfield5.text intValue];

NSString *labelStr = [[NSString alloc] initWithFormat:@"%i", val];

label.text = labelStr;[/b]

Something wrong with the code?? Alternatives maybe? Greatful for all answers!
@@rz is offline   Reply With Quote
 

» Advertisements
» Online Users: 790
15 members and 775 guests
7twenty7, armmzz, drckmchaels, erdinc27, Fahad.bhutta, falco1973, lzwasyc, MarkC, matador1978, momolgtm, m_rozzi, thewitt, tim0504, vongwaree, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,474
Threads: 94,040
Posts: 402,625
Top Poster: BrianSlick (7,978)
Welcome to our newest member, m_rozzi
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:00 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.