Search code examples
iosuiimageviewiboutletcollection

Outlet collections, i want to access the properties(hidden) for my UIimageview


I can only access the id of my outlet collection and an id does not have a hidden property

This is my outlet collection

@property (strong, nonatomic) IBOutletCollection(UIImageView) NSArray *hearts;

and this is when I try to call it, and change it to hidden.

[self.hearts objectAtIndex:0].hidden =YES;

I can not because objectAtIndex only returns an id

Thanks for any help


Solution

  • You can try enumerating the objects in the collection, using the type you expect (eg, for (UIView *heartView in self.hearts)) or first cast the objectAtIndex:0 and then set the hidden property.