Use UIView to make the effect of the neon light, and use uiview to make the neon light

Source: Internet
Author: User

Use UIView to make the effect of the neon light, and use uiview to make the neon light

Effect


The Code is as follows (only the implementation part is available)

@ Interface AppDelegate () @ end @ implementation AppDelegate-(void) dealloc {[_ window release]; [super dealloc];}-(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( 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 color block change NSTimer * timer = [nst1_scheduledtimerwithtimeinterval: 0.3 target: self selector: @ selector (changeColor) userInfo: nil repeats: YES]; return YES;}-(void) changeColor {// define a color to receive 7 color UIColor * color = [self. window viewWithTag: 7]. backgroundColor; // for (int I = 6; I> 0; I --) {[self. window viewWithTag: I + 1]. backgroundColor = [self. window viewWithTag: I]. backgroundColor;} // the innermost part is the outermost [self. window viewWithTag: 1]. backgroundColor = color;} @ end


Copyright Disclaimer: This article is an original article by the blogger. For more information, see the original article address.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.