ios - How can I use IBOutletCollection to connect multiple UIImageViews to the same outlet? -


i have 10 uiimageviews same thing (they have void methods change image timer). uiimageview outlet , want connect 10 imageviews same outlet, interface builder doesn't allow me.

i found there solution, iboutletcollection. can explain me how use connect multiple imageviews same outlet?

declare property hold imageview's , hook them in interface builder normal

@property (nonatomic, strong) iboutletcollection(uiimageview) nsarray *imageviews; 

it's normal nsarray when nib loaded populated imageview's


update

in header file view controller has multiple imageview's on need add property above - may this:

@interface myviewcontroller : uiviewcontroller  @property (nonatomic, strong) iboutletcollection(uiimageview) nsarray *imageviews; // other properties  @end 

now in interface builder connect imageview's 1 property.

enter image description here enter image description here

now work imageviews collection

for (uiimageview *imageview in self.imageviews) {   imageview.image = someimage; } 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -