appdelegate.m//nihongpractice//#import "AppDelegate.h" #define Kcolorvalue arc4random_uniform (256)/255.0# Define Kscreenwidth [UIScreen mainscreen].bounds.size.width#define kscreenheight [UIScreen mainScreen]. Bounds.size.height@interface appdelegate () @end @implementation appdelegate-(void) dealloc{Self.window = nil; [Super Dealloc]; }-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions { Self.window = [[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease]; Override point for customization after application launch. Self.window.backgroundColor = [Uicolor Whitecolor]; [Self.window makekeyandvisible]; for (int i = 0; i < i++) {UIView *view = [[UIView alloc] Initwithframe:cgrectmake (15*i, 15*i, KSCR eenWidth-30 * I, kScreenHeight-30 * i)]; Range of color values (0~255) View.backgroundcolor = [Uicolor colorwithred:kcolorvalue green:Kcolorvalue Blue:kcolorvalue alpha:1]; View.tag = + i; [Self.window Addsubview:view]; [View release]; } [Nstimer scheduledtimerwithtimeinterval:0.5 target:self selector: @selector (ChangeColor) Userinfo:nil Repeats:YES]; Every second to call the ChangeColor method, a color conversion//[self ChangeColor]; return YES;} -(void) ChangeColor {uicolor *color = [Self.window viewwithtag:200 + 10].backgroundcolor; for (int i = ten; I >= 0; i--) {[Self.window viewwithtag:200 + i].backgroundcolor = [Self.window viewwit htag:200 + I-1].backgroundcolor; The first created tag value is small, and the result is shown as converting color from outward to} [self.window viewwithtag:200].backgroundcolor = color; }
UIView's Neon light realization