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];
  }
}
È stato utile?

Soluzione

create your buttons manually then tag them one by one and you can use your buttons with tag

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top