IOS neon effect (oc)

Source: Internet
Author: User

IOS neon effect (oc)


// Initialize the view
-(Void) initViews {
// Red View
UIView * redView = [[UIView alloc] initWithFrame: CGRectMake (20, 20,280,280)];
RedView. backgroundColor = [UIColor redColor];

// View label, indicating a view object
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + Environment + CiAgICA8YnI + CiAgICA8YnI + Environment/Environment + CiAgICA8YnI + environment + Environment/Ktc/Wt63Ss9Cnufs8YnI + csf-vcd4kpha + Environment + CiAgICA8YnI + Environment = "*******" context: context];


[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];

// Set the animation duration

[UIView setAnimationDuration: 0.5];

// Because no instance variable is added to the Controller, use the following method to obtain the View

UIView * parentView = [self. view viewWithTag: 1];

// Set the animation effect

[UIView setAnimationTransition: UIViewAnimationTransitionCurlDown forView: parentView cache: YES]; // from top to bottom
[UIView setAnimationTransition: UIViewAnimationTransitionCurlUp forView: parentView cache: YES]; // bottom-up

// [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromLeft forView: parentView cache: YES]; // left to right
// [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView: parentView cache: YES]; // right to left

// Set the animation delegate
[UIView setAnimationDelegate: self];

// Call the animationFinished method when the animation ends.
[UIView setAnimationDidStopSelector: @ selector (animationFinished :)];


// Submit an animation

[UIView commitAnimations];


}

// Handle color changes
-(Void) showChangeView :( id) sender {
[Self xuanzhuang: nil];
NSLog (@ "Call the showChange Function !! ");

// Each call adds 1 to the current color

CurrentColor ++;
If (currentColor> 6 ){
CurrentColor = 0;
}
ColorArray = [NSArray arrayWithObjects: [UIColor redColor], [UIColor orangeColor], [UIColor yellowColor], [UIColor greenColor], [UIColor cyanColor], [UIColor blueColor], [UIColor purpleColor], nil];

// Initialize the view Array
For (int I = 1; I <= 7; I ++ ){

// Stores the objects of 7 views.

[ViewArray addObject: [self. view viewWithTag: I];

}



// NSLog (@ "color array size: % d", [colorArray count]);
// NSLog (@ "View Size: % d", [viewArray count]);


// Key code. Set the background color cyclically.
For (int I = 0; I <7-currentColor; I ++ ){
[[ViewArray objectAtIndex: I] setBackgroundColor: [colorArray objectAtIndex: I + currentColor];
}

For (int I = 6-currentColor, j = 0; I <7; j ++, I ++ ){
[[ViewArray objectAtIndex: I] setBackgroundColor: [colorArray objectAtIndex: j];
}

}


-(Void) viewDidLoad
{
[Super viewDidLoad];
NSLog (@ "Call the viewDidLoad Method !!! ");

Self. view = [[UIView alloc] initWithFrame: CGRectMake (0, 0,320,460)];
Self. view. backgroundColor = [UIColor clearColor];
// Initialize the view
[Self initViews];

// Define a timer to call showChangeView cyclically every 0.5 seconds: method. If you are not familiar with the usage of this timer, read other articles and explain it in detail.

NSTimer * timer = [NSTimer timerWithTimeInterval: 0.5 target: self selector: @ selector (showChangeView :) userInfo: nil repeats: YES];
Nsunloop * runloop = [nsunloop currentRunLoop];
[Runloop addTimer: timer forMode: NSDefaultRunLoopMode];


}

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.