我有一个对象数组,_schedule.games
我想在每个游戏中显示游戏属性对手,因为我循环通过时间表。
int x = 0;
for (int i = 0; i < [_schedule.games count]; i++)
{
Game *game = [_schedule.games objectAtIndex:i];
game.opponent = ((Game *) [_schedule.games objectAtIndex:i]).opponent;
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x, 0, 100, 100)];
[button setTitle:[NSString stringWithFormat:@"%@", game.opponent] forState:UIControlStateNormal];
[_gameScrollList addSubview:button];
x += button.frame.size.width;
}