Search code examples
iphoneobjective-ciosarraysiboutletcollection

How to hide a bunch of labels in an IBOutletCollection?


New to Objective-C and iOS development, would love a hand here!

I have written up some code such that

IBOutletCollection(UILabel) NSArray *allLabels;

In IB I have linked up all my labels in my view to this collection, where I want to hide them for a certain condition. However, I am not sure how to do so. Obviously to hide a single label I'd use

labelX.hidden = YES;

however it is not ideal for me to do this without a collection, as I have many labels to hide.

Thanks for your tips in advance!


Solution

  • try this...

    [allLabels setValue:@(YES) forKey:@"hidden"];