I want to use two labels on the same view in an iPod Touch application. I have created the two labels, but I only know how to access on of them. Does any one have an example of how to do this?
A:
UILabel *label1 = [[UILabel alloc] initwithFrame: CGRectMake(0,0,100,100)];
UILabel *label2 = [[UILabel alloc] initwithFrame: CGRectMake(0,0,200,200)];
label1.text = @"Label One";
label2.text = @"Label Two";
Or, if you created your labels in Interface builder, make sure you've got IBOutlet
s for both of them in order to access them from your code.
luvieere
2009-11-18 18:22:26
Is the default name label as in label.text ?
kman99
2009-11-18 20:06:30
I'm not sure what you mean by default name. The idea is to have control over variable names, not rely on defaults, in fact, you must know what IBOutlet you link your IB labels to.
luvieere
2009-11-19 11:50:31