create your buttons manually then tag them one by one and you can use your buttons with tag
IBOutletCollection objects indexed wrong
-
26-06-2022 - |
Domanda
i have 10 uibuttons on story board and i've linked them with iboutletcollections. Then i set buttons backgroundimage from array of uiimage using loop. When i run my project button indexes differs from image indexes
Here is my code
-(void)setButtonImages
{
for (int i=0; i<imageArray.count; i++)
{
UIButton *b =[self.myButtons objectAtIndex:i];
[b setBackgroundImage:[imageArray objectAtIndex:i] forState:UIControlStateNormal];
}
}
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow