2024年4月26日发(作者:)

汤姆猫代码实现

//

// ViewController.m

// Tom

//

// Created by administrator on 15/8/4.

// Copyright (c) 2015年 gengcong. All rights reserved.

//

#import "ViewController.h"

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UIImageView *tom;

- (IBAction)drinkClick:(id)sender;

- (IBAction)peiClick:(id)sender;

- (IBAction)eatClick:(id)sender;

- (IBAction)cymbalClick:(id)sender;

- (IBAction)scratchClick:(id)sender;

- (IBAction)fart:(id)sender;

- (IBAction)stomach:(id)sender;

- (IBAction)footleft:(id)sender;

- (IBAction)footright:(id)sender;

- (IBAction)knockoutClick:(id)sender;

- (IBAction)angryClick:(id)sender;

@end

@implementation ViewController

- (IBAction)drinkClick:(id)sender {

[self runAnimationWithName:@"drink" andcount:81];

}

- (IBAction)peiClick:(id)sender {

[self runAnimationWithName:@"pie" andcount:24];

}

- (IBAction)eatClick:(id)sender {

[self runAnimationWithName:@"eat" andcount:40];

}

- (IBAction)cymbalClick:(id)sender {

[self runAnimationWithName:@"cymbal" andcount:13];

}

- (IBAction)scratchClick:(id)sender {

[self runAnimationWithName:@"scratch" andcount:56];

}

- (IBAction)fart:(id)sender {

[self runAnimationWithName:@"fart" andcount:28];

}

- (IBAction)stomach:(id)sender {

[self runAnimationWithName:@"stomach" andcount:34];

}

- (IBAction)footleft:(id)sender {

[self runAnimationWithName:@"footRight" andcount:30];

}

- (IBAction)footright:(id)sender {

[self runAnimationWithName:@"footLeft" andcount:30];

}

- (IBAction)knockoutClick:(id)sender {

[self runAnimationWithName:@"knockout" andcount:81];

}

- (IBAction)angryClick:(id)sender {

[self runAnimationWithName:@"angry" andcount:26];

}

-(void)runAnimationWithName:(NSString*)name andcount:(int)counts

{

if (ating) return;