您的位置:首页 > 运维架构 > Tomcat

Tomcat源码iOS

2015-09-06 21:18 591 查看
#import "ViewController.h"

@interface
ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {

[super
viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.
}

-(void)startAnimationWithImgName:(NSString *)name imageCount:(int)count{

if (self.imgeView.isAnimating) {

return;
}

NSMutableArray *array = [[NSMutableArray
alloc]
init];

for (int i =
0; i < count; i++) {

NSString *imageName = [NSString
stringWithFormat:@"%@_%02d",name,i];

//UIImage *image = [UIImage imageNamed:imagePath];

//获取资源路径(包括图片、音频)

NSString *imgPath = [[NSBundle
mainBundle] pathForResource:imageName
ofType:@"jpg"];

UIImage *image = [[UIImage
alloc] initWithContentsOfFile:imgPath];

[array
addObject:image];
}

self.imgeView.animationImages = array;

self.imgeView.animationDuration =
0.06 * count;

self.imgeView.animationRepeatCount =
1;

[self.imgeView
startAnimating];

//1、定时器
动画结束之后回收内存

//[NSTimer scheduledTimerWithTimeInterval:self.imgeView.animationDuration target:self selector:@selector(clearMemory) userInfo:nil repeats:NO];

//2、延迟调用 performSelector

//[self performSelector:@selector(clearMemory) withObject:nil afterDelay:self.imgeView.animationDuration];

//3、延迟调用 setAnimationImages:

[self.imgeView
performSelector:@selector(setAnimationImages:)
withObject:nil
afterDelay:self.imgeView.animationDuration];

//[self performSelector:@selector(setAnimationImages:) withObject:nil afterDelay:self.imgeView.animationDuration];
}

-(void)clearMemory{

//self.imgeView.animationImages = nil;

[self.imgeView
setAnimationImages:nil];
}

- (IBAction)btnClick:(UIButton *)sender {

switch (sender.tag) {

case 1://点击头部
{

[self
startAnimationWithImgName:@"knockout"
imageCount:81];
}

break;

case 2://金钹
{

[self
startAnimationWithImgName:@"cymbal"
imageCount:13];
}

break;

case 3://喝奶
{

[self
startAnimationWithImgName:@"drink"
imageCount:81];
}

break;

case 4://吃鸟
{

[self
startAnimationWithImgName:@"eat"
imageCount:40];
}

break;

case 5:
{

}

break;

case 6:
{

}

break;

case 7:
{

}

break;

case 8:
{

}

break;

case 9:
{

}

break;

default:

break;
}
}

- (void)didReceiveMemoryWarning {

[super
didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.
}

@end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: