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
@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
相关文章推荐
- Windows下JDK,Tomcat,Eclipse安装配置
- jenkins , ant ctomcat+shell报ant: command not foun.
- Win7(64)+eclipse(64)+tomcat7(64)+jdk7(64)开发环境配置
- Puppet 部署tomcat
- tomcat内存调试
- Tomcat 启动端口冲突异常
- Eclipse 导入外部项目无法识别为web项目并且无法在部署到tomcat下
- Tomcat中常见线程说明
- tomcat记录控制台输出信息至文件
- tomcat实现SSL认证
- Nginx+Tomcat 实现负载均衡(Windows单机测试)
- 《how tomcat work》 搬运工 Chapter 9: Session Management
- linux tomcat创建文件夹乱码(显示:???)
- 安装版的tomcat6.0 内存设置【tomcat6.0内存溢出】
- tomcat绿色版及安装版修改内存大小的方法
- tomcat 域名解析
- tomcat如何避免遭遇ClassNotFoundException
- tomcat7-maven-plugin启动maven项目异常
- Linux下安装Tomcat服务器和部署Web应用
- 简单搭建Nginx+Tomcat负载均衡群集