I have a method:
-(void) generateButtons {
int positionsLeftInRow = BUTTONS_PER_ROW;
int j = 0;
for (int i = 0; i < [self.Model.buttons count]; i++) {
NSInteger value = ((Model *)self.Model.buttons[i]).value;
ButtonView *cv = [[ButtonView alloc] initWithFrame:CGRectMake((i % BUTTONS_PER_ROW) * 121 + (i % BUTTONS_PER_ROW) * 40 + 205, j * 122 + j * 40 + 320, 125, 125) andPosition:i andValue:value];
if (!((Model *)self.Model.buttons[i]).outOfPlay) {
[self.boardView addSubview:cv];
if ([self.Model.usedButtons containsObject: self.Model.buttons[i]]) {
[self.usedButtons addObject: cv];
[cv flip];
}
}
if (--positionsLeftInRow == 0) {
j++;
positionsLeftInRow = BUTTONS_PER_ROW;
}
}
}
So, my question is, how to make a horizontal displacement for each line, that the second line is displaced from 1st and 3rd for example.
Aucun commentaire:
Enregistrer un commentaire