Reputation: 82
This is just a quick question, I have lots of outlets in my code that need to be hidden initially and I want to make it so that in my viewDidLoad I only have to say something along the lines of colourObjects.hidden = YES;
rather than individually going through and declaring if they are hidden or not i.e. redColourObject.hidden = YES;
blueColourObjects.hidden = YES;
greenColourObjects.hidden = YES;
I would find it very grateful to know if this is possible and how you do it!
Thanks for any help Hugh
Upvotes: 0
Views: 288
Reputation: 3591
IBOutletCollection is what you need:
@property (nonatomic, strong) IBOutletCollection(UIView) NSArray *stuff;
You can drag as many outlets as you want in it and they'll be there. You can also keep the original references for other purposes. then
for (UIView *view in self.stuff) {
[view setHidden:YES];
}
Upvotes: 4
Reputation: 27
Sorry but there is not a way to do that. You would have to declare that individually.
What you could do I put them all into one UIView and then hide the UIView which would hide everything in in the UIView.
Upvotes: -2