According Apple specifications IB objects are to be defined using Storyboard/Xib.
For some projects this may result in defining long lists of UILabels, UIButtons etc.
Which have to be connected to the code using IBOutlet’s.
Example:
@property (nonatomic, retain) IBOutlet UILabel *label1;
@property (nonatomic, retain) IBOutlet UILabel *label2;
...
@property (nonatomic, retain) IBOutlet UILabel *label998;
@property (nonatomic, retain) IBOutlet UILabel *label999;
Is there a way to identify a UILabel (or UIBUtton or UIImage etc) in the source code, and use that to change the content/properties of the Object?
Example pseudo code:
for (i=0;i<100;i++) {
<label i>.text = @"...";
}
In the above code, I want to assign a string value to all the labels. How can this be done, so instead of the a way to identify the label.
You can set tag for UILabels in Interface Builder and later on identify them using tags.
For example you can set tag from 1001 to 2000 for your 1000 labels and later on you can use this code to get the labels at runtime :-
In this way your first label will have a tag 1001 and last label will have a tag 2000 and you can use these labels in functions or in a loop.