- (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 发布
本文介绍了一个简单的iOS应用启动动画实现方案。通过使用不同颜色的UIView并调整其位置和大小,创建了一个动态变化的视觉效果。此外,还利用定时器实现了颜色的循环渐变。
1449

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



