我有两个为视图添加子视图的 for 循环。第一个添加了所有子视图,但第二个 for 循环甚至没有执行!这是怎么回事?
- (void)createBoxes
{
for (int i; i<5; i++) {
GameBox *box = [[GameBox alloc] initWithFrame:CGRectMake((i * 64) + 7, 50, 50, 50)];
[self.view addSubview:box];
}
for (int e; e<5; e++) {
GameBox *box1 = [[GameBox alloc] initWithFrame:CGRectMake((e * 64) + 7, 107, 50, 50)];
[self.view addSubview:box1];
}
}