Hi All,
Two Complete newbie questions about programming in ObjC - using ideas from other languages I've used in the past. It'd be great if such concepts existed in ObjC, but all the info I've been able to gather so far is all about the simple stuff like "for" loops, etc.
Question 1
Is there a way in Objective C of evaluating a variable first before executing a line?
For example, let's say I have 5 labels for which I want to change the text. I could do something like:
Label1.text = array(1)
Label2.text = array(2)
Label3.text = array(3)
Label4.text = array(4)
Label5.text = array(5)
but what I REALLY want to do is this:
for (x=0; x<=5; x++) {
Label'x'.text = array(x)
}
Is this even possible in Objective C? If so, any idea what it's called or what the syntax is?
Question 2
Related to the above, is there any way to do something similar with objects?
example:
foo = objectA
'foo'.textcolor = red
foo = objectB
'foo'.textcolor = green
so... then there are 2 objects with different text colors -
objectA is red, objectB is green. foo is just a "placeholder" or "stand-in" object without any properties itself.
Does any of this make sense to anyone else?
LOL
Thanks in advance,
-Leevy