// Extend the object to be added
@ Interface appdelegate ()
{
Uiview * _ containerview;
Nstimer * _ timer;
}
@ End
//-(Bool) Application :( uiapplication *) Application didfinishlaunchingwitexceptions :( nsdictionary *) function body in launchoptions //
_ Containerview = [[uiview alloc] initwithframe: cgrectmake (0, 0,320,568)];
_ Containerview. backgroundcolor = [uicolor clearcolor];
[Self. Window addsubview: _ containerview];
[_ Containerview release];
Nsarray * array = [nsarray arraywithobjects: [uicolor redcolor], [uicolor orangecolor], [uicolor yellowcolor], [uicolor greencolor], [uicolor bluecolor], [uicolor cyancolor], [uicolor purplecolor], nil];
For (INT I = 0; I <7; I ++ ){
Uiview * view = [[uiview alloc] initwithframe: cgrectmake (20 + I * 20,120 + I * 20,280-I * 40,280-I * 40)];
View. backgroundcolor = array [I];
View. Tag = I + 200;
Nslog (@ "% lD", (long) view. Tag );
[_ Containerview addsubview: View];
[View release];
}
Uibutton * button1 = [uibutton buttonwithtype: uibuttontypesystem
];
Button1.frame = cgrectmake (40,450, 70, 40 );
Button1.backgroundcolor = [uicolor cyancolor];
[Button1 settitle: @ "Inside and Outside" forstate: uicontrolstatenormal];
[Button1 addtarget: Self action: @ selector (changefromintoout) forcontrolevents: uicontroleventtouchupinside];
Button1.layer. cornerradius = 7;
[_ Containerview addsubview: button1];
Uibutton * button2 = [uibutton buttonwithtype: uibuttontypesystem
];
Button2.frame = cgrectmake (125,450, 70, 40 );
Button2.backgroundcolor = [uicolor cyancolor];
[Button2 settitle: @ "stop" forstate: uicontrolstatenormal];
[Button2 addtarget: Self action: @ selector (STOP) forcontrolevents: uicontroleventtouchupinside];
Button2.layer. cornerradius = 7;
[_ Containerview addsubview: button2];
Uibutton * button3 = [uibutton buttonwithtype: uibuttontypesystem
];
Button3.frame = cgrectmake (210,450, 70, 40 );
Button3.backgroundcolor = [uicolor cyancolor];
[Button3 settitle: @ "from outside" forstate: uicontrolstatenormal];
[Button3 addtarget: Self action: @ selector (changefromouttoin) forcontrolevents: uicontroleventtouchupinside];
Button3.layer. cornerradius = 7;
[_ Containerview addsubview: button3];
// Set the timer
-(Void) changefromintoout
{
_ Timer = [nstimer scheduledtimerwithtimeinterval: 0.3 target: Self selector: @ selector (changeintoout) userinfo: Nil repeats: Yes];
}
-(Void) changefromouttoin
{
_ Timer = [nstimer scheduledtimerwithtimeinterval: 0.3 target: Self selector: @ selector (changeouttoin) userinfo: Nil repeats: Yes];
}
// Pause the timer
-(Void) Stop
{
[_ Timer invalidate];
}
// Color switching from the inside out Loop
-(Void) changequota out
{
Uiview * temp = [[uiview alloc] init];
Int I = 200;
Temp. backgroundcolor = [_ containerview viewwithtag: 200]. backgroundcolor;
For (I = 200; I <207; I ++ ){
[_ Containerview viewwithtag: I]. backgroundcolor = [_ containerview viewwithtag: I + 1]. backgroundcolor;
}
[_ Containerview viewwithtag: 206]. backgroundcolor = temp. backgroundcolor;
[Temp release];
}
// Color exchange by external and inner Loops
-(Void) changeouttoin
{
Uiview * temp = [[uiview alloc] init];
Int I = 206;
Temp. backgroundcolor = [_ containerview viewwithtag: 206]. backgroundcolor;
For (I = 206; I> = 0; I --){
[_ Containerview viewwithtag: I]. backgroundcolor = [_ containerview viewwithtag: I-1]. backgroundcolor;
}
[_ Containerview viewwithtag: 200]. backgroundcolor = temp. backgroundcolor;
[Temp release];
}
Implement the flashing effect of neon lights (UI)