• iOS学习


    //
    //  YJViewController.m
    //  04-汤姆猫的理解
    //
    //  Created by JACKY-MAC on 15-5-31.
    //  Copyright (c) 2015年 www.train.com. All rights reserved.
    //
    
    #import "YJViewController.h"
    
    @interface YJViewController ()
    @property (weak, nonatomic) IBOutlet UIImageView *tom;
    
    @end
    
    @implementation YJViewController
    - (void)tomAnimationWithName:(NSString *) name  andCount:(NSInteger)count
    {
        if ([self.tom isAnimating]) return;
            
        
        // 动画图片的数
        NSMutableArray *arrayM = [NSMutableArray array];
        
        // 添加动画播放的图片
        
        for (int i=0; i<count; i++) {
            
              // 图像名称
            NSString *imageName = [NSString stringWithFormat:@"%@_%02d.jpg",name,i];
            
            NSString *path = [[NSBundle mainBundle] pathForResource:imageName ofType:nil];
            UIImage *image = [UIImage imageWithContentsOfFile:path];
            
            [arrayM addObject:image];
        }
        
           // 设置动画数组
        self.tom.animationImages = arrayM;
        
            // 重复1次
        self.tom.animationRepeatCount = 1;
        
            // 动画时长
        self.tom.animationDuration = self.tom.animationImages.count * 0.075;
        
         // 开始动画
        [self.tom startAnimating];
        
        
        // 动画"结束"之后,清理动画数组
        [self.tom performSelector:@selector(setAnimationImages:) withObject:nil
                       afterDelay:self.tom.animationDuration];
        
    }
    /*
    - (IBAction)tomAction:(UIButton *)sender
    {
            // currentTitle 可以取出按钮当前的标题文字
        [self tomAnimationWithName:sender.currentTitle andCount:sender.tag];
    }
    
    */
    - (IBAction)knockout
    {
        [self tomAnimationWithName:@"knockout" andCount:81];
    }
    
    
    - (IBAction)eat
    {
        [self tomAnimationWithName:@"eat" andCount:40];
    }
    
    
    - (IBAction)cymbal
    {
        [self tomAnimationWithName:@"cymbal" andCount:12];
    }
    
    - (IBAction)drink
    {
        [self tomAnimationWithName:@"drink" andCount:80];
    }
    
    - (IBAction)fart
    {
        [self tomAnimationWithName:@"fart" andCount:27];
    }
    
    -(IBAction)pie
    {
        [self tomAnimationWithName:@"pie" andCount:23];
    }
    
    - (IBAction)scratch
    {
        [self tomAnimationWithName:@"scratch" andCount:55];
    }
    
    
    - (IBAction)stomach
    {
        [self tomAnimationWithName:@"stomach" andCount:34];
    }
    
    - (IBAction)footLeft
    {
        [self tomAnimationWithName:@"footLeft" andCount:30];
    }
    
    - (IBAction)footRight
    {
        [self tomAnimationWithName:@"footRight" andCount:30];
    }
    @end

  • 相关阅读:
    windows下vs2015编译BOOST
    第一篇 CUDA基础
    【windows】vs添加库外部库的一般步骤
    关于模板
    命令收集
    【4】facebook大数据搜索库faiss使用——Faiss索引介绍
    【2】facebook大数据搜索库faiss使用
    【ubuntu】windows链接库——怎样从DLL导出C++类
    【3】facebook大数据搜索库faiss使用——选择Index
    【ubuntu】linux链接库
  • 原文地址:https://www.cnblogs.com/yejian/p/4761581.html
Copyright © 2020-2023  润新知