YIem`s Blog -心比天高命比纸薄-链接找不到的请在站内搜索内容!

iOS-TOM猫-汤姆猫动画播放-UIImageVIew

iOS-TOM猫-汤姆猫动画播放-UIImageVIew

#import "ViewController.h"

@interface ViewController ()
@property (nonatomic, retain) UIImageView *img;
@end

@implementation ViewController

self.img.image = [UIImage imageNamed:@"angry_00.jpg"];

// 看见按钮
// 左
// 小鸟
[self xiaonian];
// 爪子
[self zuoTwo];
// 响声
[self xSheng];
// 右
// 放屁
[self fPi];
// 喝奶
[self heN];
// 砸屏
[self zaiping];
// 隐藏按钮
[self anto];
[self anzhon];
[self anxiao];
[self anfootLeft];
[self anfootRight];
[self m];

}

// 小鸟

// 爪子

// 响声
-(void)xSheng
{

UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectMake(20, 520, 50, 50);
[button setBackgroundImage:[UIImage imageNamed:@"cymbal.png"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(xShengAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];

}

NSMutableArray *shengArr  = [NSMutableArray array];
for (NSInteger i = 0; i < 12; i++) {
    NSString *str = [NSString stringWithFormat:@"cymbal_%02ld.jpg", i];
    UIImage *img = [UIImage imageNamed:str];
    [shengArr addObject:img];
}
self.img.animationImages = shengArr;
self.img.animationRepeatCount = 1;
self.img.animationDuration = 2;

[self.img startAnimating];

}

// 右
// 放屁

NSMutableArray *imgArr = [NSMutableArray array];
for (NSInteger i = 0; i < 27; i++) {
    NSString *str = [NSString stringWithFormat:@"fart_%02ld.jpg", i];
    UIImage *imgimg = [UIImage imageNamed:str];
    [imgArr addObject:imgimg];
}
self.img.animationImages = imgArr;
self.img.animationRepeatCount = 1;
self.img.animationDuration = 2;

[self.img startAnimating];

}
// 喝奶

NSMutableArray *arr =[NSMutableArray array];
for (NSInteger i = 0; i < 80; i++) {
    NSString *str = [NSString stringWithFormat:@"drink_%02ld.jpg", i];
    UIImage *imgimg = [UIImage imageNamed:str];
    [arr addObject:imgimg];
}
self.img.animationImages = arr;
self.img.animationRepeatCount = 1;
self.img.animationDuration = 5;

[self.img startAnimating];

}
// 砸屏

NSMutableArray *arr = [NSMutableArray array];
for (NSInteger i = 0; i < 23; i++) {
    NSString *str = [NSString stringWithFormat:@"pie_%02ld.jpg", i];
    UIImage *imgN = [UIImage imageNamed:str];
    [arr addObject:imgN];
}
self.img.animationImages = arr;
self.img.animationRepeatCount = 1;

[self.img startAnimating];

}

// 隐藏按钮

{

UIButton *anfootLeft = [UIButton buttonWithType:UIButtonTypeSystem];
anfootLeft.frame = CGRectMake(140, 610, 35, 35);
// anfootLeft.backgroundColor = [UIColor yellowColor];
[anfootLeft addTarget:self action:@selector(anright) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:anfootLeft];

}

// 隐藏动画















当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »