- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
NSMutableArray *arr = [NSMutableArray arrayWithObjects:[UIColor redColor], [UIColor yellowColor],[UIColor blueColor],[UIColor greenColor],[UIColor grayColor],[UIColor purpleColor],[UIColor orangeColor],nil];
for (int i = 0 ; i < 7; i++) {
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0 + i * 20, 0 + i *20, 320 - 40 * i , 568 - i * 40)];
view.tag = 100 + i;
view.backgroundColor = arr[i];
[self.window addSubview:view];
[view release];
}
[NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(time) userInfo:nil repeats:YES];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
- (void)time
{
UIColor *temp = [self.window viewWithTag:100 ].backgroundColor;
for (int i = 0; i <7; i++) {
[self.window viewWithTag:100 +i ].backgroundColor = [self.window viewWithTag:101 +i ].backgroundColor;
}
[self.window viewWithTag:106 ].backgroundColor = temp;
}
UI中霓虹灯效果代码
最新推荐文章于 2024-04-16 19:54:26 发布