I have a top list view in my current iPhone app, that's populated by code. I've assembled the view using Interface Builder, so it contains lot of UILabel
s.
Obviously I wouldn't like to have name1
, name2
, etc. outlets in my class, but prefer a name[10]
array.
Is it possible to do so, and connect each item to the appropriate label (or any other interface builder like view)?
You can of course do this with interface builder, the keyword is IBOutletCollection
. What it does is basically an NSArray out of multiple interface builder outlets.
IBOutletCollection(UILabel) NSArray *myLabels;
So the next thing would be connecting your labels in interface builder and then you can use the array to access all labels at runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With