rainbowview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 568)];
NSArray*colorArr =@[[UIColor redColor],[UIColor orangeColor],[UIColor yellowColor],[UIColor greenColor],[UIColor blueColor],[UIColor cyanColor],[UIColor purpleColor]];
for (int i = 0; i<7; i++) {
UIView *rainbownil = [[UIView alloc] initWithFrame:CGRectMake(10+20*i, 50+20*i, 300-40*i, 500-40*i)];
rainbownil.backgroundColor = colorArr[i];
rainbownil.tag = 101+i;
[rainbowview addSubview:rainbownil];
[rainbownil release];
}
[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(exchangeColor) userInfo:self repeats:YES];
[self.window addSubview:rainbowview];
[rainbowview release];
NSArray*colorArr =@[[UIColor redColor],[UIColor orangeColor],[UIColor yellowColor],[UIColor greenColor],[UIColor blueColor],[UIColor cyanColor],[UIColor purpleColor]];
for (int i = 0; i<7; i++) {
UIView *rainbownil = [[UIView alloc] initWithFrame:CGRectMake(10+20*i, 50+20*i, 300-40*i, 500-40*i)];
rainbownil.backgroundColor = colorArr[i];
rainbownil.tag = 101+i;
[rainbowview addSubview:rainbownil];
[rainbownil release];
}
[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(exchangeColor) userInfo:self repeats:YES];
[self.window addSubview:rainbowview];
[rainbowview release];
// [colorArr release];
最后一句,过度释放了,colorArr注释掉就好了
12万+

被折叠的 条评论
为什么被折叠?



