0

In my storyboard I have one UIImageView for traits RegularRegular and another one for the rest of traits.

This is because they have different layout rules and they have different configuration too.

I want to link them with the viewcontroller, but I found I have to create a property for each one. If I link the property with one of the UIImageView it will remove the link with the other UIImageView

Is there a way to link both UIImageView over one property in my ViewController so XCode will chose which one in each case, or the only way is to create two properties?

xarly
  • 2,054
  • 4
  • 24
  • 40
  • Possible duplicate of [How can I use IBOutletCollection to connect multiple UIImageViews to the same outlet?](https://stackoverflow.com/questions/15836930/how-can-i-use-iboutletcollection-to-connect-multiple-uiimageviews-to-the-same-ou) – Saad Chaudhry Feb 20 '18 at 13:04

1 Answers1

0

You can create outlet collections:

@property (nonatomic, strong) IBOutletCollection(UIImageView) NSArray *myImageViews;
Durdu
  • 4,649
  • 2
  • 27
  • 47
  • Yeah, I was thinking about that solution, but I still have to decide the index of the array. I was thinking more about having a UIImageView that is set up depending of the trait I guess it's closer than having multiple properties. Thanks :) – xarly Feb 20 '18 at 14:16
  • Maybe create a custom getter – Durdu Feb 20 '18 at 14:31