Effect
The code is as follows (only the implementation section)
@interface appdelegate () @end @implementation appdelegate-(void) dealloc{[_window release]; [Super Dealloc];} -(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions { Self.window = [[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; Override point for customization after application launch. Self.window.backgroundColor = [Uicolor Whitecolor]; [Self.window makekeyandvisible]; [_window release]; Define view, color module UIView *view1 = [[UIView alloc] Initwithframe:cgrectmake (20, 20, 340, 340)]; View1.backgroundcolor = [Uicolor Greencolor]; [Self.window Addsubview:view1]; [View1 release]; View1.tag = 1; UIView *view2 = [[UIView alloc] Initwithframe:cgrectmake (40, 40, 300, 300)]; View2.backgroundcolor = [Uicolor Purplecolor]; [Self.window Addsubview:view2]; [View2 release]; View2.tag = 2; UIView *VIEW3 = [[UIView alloc] Initwithframe:cgrectmake (60, 60, 260, 260)]; View3.backgroundcolor = [Uicolor Magentacolor]; [Self.window ADDSUBVIEW:VIEW3]; [VIEW3 release]; View3.tag = 3; UIView *view4 = [[UIView alloc] Initwithframe:cgrectmake (80, 80, 220, 220)]; View4.backgroundcolor = [Uicolor Redcolor]; [Self.window ADDSUBVIEW:VIEW4]; [View4 release]; View4.tag = 4; UIView *view5 = [[UIView alloc] initwithframe:cgrectmake (100, 100, 180, 180)]; View5.backgroundcolor = [Uicolor Orangecolor]; [Self.window ADDSUBVIEW:VIEW5]; [VIEW5 release]; View5.tag = 5; UIView *view6 = [[UIView alloc] Initwithframe:cgrectmake (120, 120, 140, 140)]; View6.backgroundcolor = [Uicolor Yellowcolor]; [Self.window ADDSUBVIEW:VIEW6]; [VIEW6 release]; View6.tag = 6; UIView *view7 = [[UIView alloc] Initwithframe:cgrectmake (140, 140, 100, 100)]; View7.backgroundcolor = [Uicolor Cyancolor]; [Self.window ADDSUBVIEW:VIEW7]; [View7 release]; View7.tag = 7; Define a timer to implement the color block change nstimer *timer = [NStimer scheduledtimerwithtimeinterval:0.3 target:self selector: @selector (ChangeColor) Userinfo:nil Repeats:yes]; return YES;} -(void) changecolor{//define a color to receive 7 colors Uicolor *color = [Self.window viewwithtag:7].backgroundcolor; Loop swap color for (int i = 6; i > 0; i--) {[Self.window viewwithtag:i + 1].backgroundcolor = [Self.window vieww Ithtag:i].backgroundcolor; }//Swaps the innermost and outermost values [self.window viewwithtag:1].backgroundcolor = color;} @end
Copyright NOTICE: This article is the original article of Bo Master, please specify the original address
Use UIView to make neon effects