Question

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];
  }
}
Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top