Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sheepopo39

macrumors 6502
Original poster
Sep 18, 2008
251
0
I've recently started programming for the iphone/ipad. I can program in Objective-C on the Mac.

For some odd reason, "setIntValue" is not available on the iphone/ipad sdk, and I was wondering what the equivalent of it was?

Edit: Found you had to use SetValue, but you have to convert it to a string first. Anyone know another way to do it without having to convert it to a string, as this is a waste of time. Why did apple remove the setXValue from the UIKit?
 

sheepopo39

macrumors 6502
Original poster
Sep 18, 2008
251
0
Okay, so I got it to work by adding this line of code
"[label setValue:[NSString stringWithFormat:mad:"%d", i]];"

But it over laps anything that was there before, is there any other way?

So the question is, is there a method in the iphone/ipad sdk that will have the same function as setXValue?

Edit: All of the other methods of doing it that I found, all had the new text overlapping the old text. Won't this be a problem if you need to often change the value in the same textField?
 

chown33

Moderator
Staff member
Aug 9, 2009
10,748
8,421
A sea of green
Okay, so I got it to work by adding this line of code
"[label setValue:[NSString stringWithFormat:mad:"%d", i]];"

But it over laps anything that was there before, is there any other way?
The text property of UILabel?

I see no value property for UILabel or its superclasses. Is there a compiler warning for setValue:?

What type is your 'label' variable? Its name suggests UILabel type, but you mention "textField", so it's unclear. FWIW, UITextField has no value property, either, but it has a text property.

Are you running on the simulator?


All of the other methods of doing it that I found, all had the new text overlapping the old text.
What are the other methods? Be specific.

How did you find those other methods?
I found the text property quite easily in the UILabel and UITextField reference docs.
http://developer.apple.com/iphone/l...eference/UILabel_Class/Reference/UILabel.html
http://developer.apple.com/iphone/l.../UITextField_Class/Reference/UITextField.html

Google search terms:
uilabel iphone reference
uitextfield iphone reference
 

pflau

macrumors 6502
Sep 17, 2007
407
45
Edit: All of the other methods of doing it that I found, all had the new text overlapping the old text. Won't this be a problem if you need to often change the value in the same textField?

There would not be a problem. Reason being that you don't know how the property setter is implemented and you shouldn't care. You just need to supply a NSString object. If you don't want to keep creating new NSString objects, maybe you can try NSMutableString.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.