How to make IBOutlets out of an array of objects? How to make IBOutlets out of an array of objects? ios ios

How to make IBOutlets out of an array of objects?


It is possible, it’s called outlet collection. This is the way to define an outlet collection:

@property(retain) IBOutletCollection(UIImageView) NSArray *images;

Now you can stick more than one object into the outlet in the Interface Builder, the array will be created for you when the interface is loaded.


I'm a little late here but it may be easier to set the tag property of each ImageView in IB, then access them like [some_superview viewWithTag:tag] rather than keep a separate handle to each one.


Swift 3 and above:

@IBOutlet var stuckLabels: [UIImageView]