源码简介:可爱的汤姆猫会实现,吃早餐,打哈欠等搞笑动作。
源码效果:
源码片段:
- -(void)btnClick:(UIButton *)button
- {
- if (button.tag==1) {
- NSMutableArray *arrM=[[NSMutableArray alloc] init];
- for (NSInteger i=0; i<12; i++) {
- NSString *name=[NSString stringWithFormat:@"cat_cymbal00%02ld.jpg",i];
- [arrM addObject:[UIImage imageNamed:name]];
- }
- imageView.animationImages=arrM;
- imageView.animationDuration=3.0;
- imageView.animationRepeatCount=1;
- [imageView startAnimating];
- [self performSelector:@selector(playSoundWithFileName:) withObject:@"cymbal" afterDelay:0.5];
- }else if (button.tag==2){
- NSMutableArray *arrM=[[NSMutableArray alloc] init];
- for (NSInteger i=0; i<27; i++) {
- NSString *name=[NSString stringWithFormat:@"cat_fart00%02ld.jpg",i];
- [arrM addObject:[UIImage imageNamed:name]];
- }
- imageView.animationImages=arrM;
- imageView.animationDuration=5.0;
- imageView.animationRepeatCount=1;
- [imageView startAnimating];
- [self performSelector:@selector(playSoundWithFileName:) withObject:@"fart003_11025" afterDelay:0.6];
- }else if (button.tag==3){
- NSMutableArray *arrM=[[NSMutableArray alloc] init];
- for (NSInteger i=0; i<39; i++) {
- NSString *name=[NSString stringWithFormat:@"cat_eat00%02ld.jpg",i];
- [arrM addObject:[UIImage imageNamed:name]];
- }
- imageView.animationImages=arrM;
- imageView.animationDuration=3.0;
- imageView.animationRepeatCount=1;
- [imageView startAnimating];
- [self performSelector:@selector(playSoundWithFileName:) withObject:@"p_eat" afterDelay:0.5];
- }