[Code Note] watering animation, note watering Animation

Source: Internet
Author: User

[Code Note] watering animation, note watering Animation

I ,.

2. Engineering Drawing.

3. Code.

RootViewController. h

#import <UIKit/UIKit.h>@interface RootViewController : UIViewController{    NSTimer *timer;    int i;}@end


RootViewController. m

-(Void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. // initialize the background image [self initBackGroundView];} # pragma-mark-functions // background image-(void) initBackGroundView {// UIImageView * loadPeopleView = [[UIImageView alloc] initWithFrame: CGRectMake (130,100,156,172)]; loadPeopleView. tag = 101; loadPeopleView. alpha = 1.0f; loadPeopleView. backgroundColor = [UIColor clearColor]; [loadPeopleView setImage: [UIImage imageNamed: @ "blank"]; // flowers UIImageView * loadFlowerView = [[UIImageView alloc] initWithFrame: CGRectMake (70,200, 62, 75)]; loadFlowerView. tag= 102; loadFlowerView. alpha = 1.0f; [loadFlowerView setImage: [UIImage imageNamed: @ "problem_load1.png"]; [self. view addSubview: loadPeopleView]; [self. view addSubview: loadFlowerView]; timer = [NSTimer scheduledTimerWithTimeInterval: 0.5 target: self selector: @ selector (animation :) userInfo: nil repeats: YES];} // animation-(void) animation :( NSTimer *) timer {NSLog (@ "-I-% I --", I); UIImageView * imageView = (UIImageView *) [self. view viewWithTag: 102]; I ++; if (I % 3 = 0) {[imageView setImage: [UIImage imageNamed: @ "problem_load1.png"];} else if (I % 3 = 1) {[imageView setImage: [UIImage imageNamed: @ "problem_load2.png"];} else {[imageView setImage: [UIImage imageNamed: @ "problem_load3.png"];}


Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.