16.小项目:汤姆猫 版本2.0

-------------  ViewController.m  -------------

#import "ViewController.h"

@interface ViewController ()

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

- (IBAction)drink;

- (IBAction)konckOut;

- (IBAction)footLeft;

@end

@implementation ViewController

- (IBAction)drink

{

[self playAnimationWithImageName:@"drink" andImageCount:81];

}

- (IBAction)konckOut

{

[self playAnimationWithImageName:@"knockout" andImageCount:81];

}

- (IBAction)footLeft

{

[self playAnimationWithImageName:@"footLeft" andImageCount:30];

}

- (void) playAnimationWithImageName:(NSString *) imageName andImageCount:(NSInteger) count

{

if(self.imageView.isAnimating)

{

return;

}

NSMutableArray *images = [NSMutableArray array];

for (int i = 0; i < count; i++)

{

NSString *name = [NSString stringWithFormat:@"%@_%02d",imageName,i];

UIImage *image = [UIImage imageNamed:name];

[images addObject:image];

}

self.imageView.animationImages = images;

self.imageView.animationDuration = 0.05 * count;

self.imageView.animationRepeatCount = 1;

[self.imageView startAnimating];

}

@end

时间: 2024-10-18 09:55:36

16.小项目:汤姆猫 版本2.0的相关文章

15.小项目:汤姆猫 版本1.0

-------------  ViewController.m  ------------- #import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UIImageView *imageView; - (IBAction)drink; - (IBAction)konckOut; - (IBAction)footLeft; @end @implementati

17.小项目:汤姆猫 版本3.0

@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); -------------  ViewController.m  ------------- #import "ViewController.h" @interface ViewController () @property (weak, nonat

24.小项目:应用市场 版本7.0

@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); ------------- CZapp.h ------------- #import <Foundation/Foundation.h> @interface CZApp : NSObject @property (nonatomic,copy) NSSt

22.小项目:应用市场 版本5.0

------------- CZapp.h ------------- #import <Foundation/Foundation.h> @interface CZApp : NSObject @property (nonatomic,copy) NSString *name; @property (nonatomic,copy) NSString *icon; - (instancetype) initWithDict:(NSDictionary *) dict; + (instancet

25.小项目:应用市场 版本8.0

------------- CZapp.h ------------- #import <Foundation/Foundation.h> @interface CZApp : NSObject @property (nonatomic,copy) NSString *name; @property (nonatomic,copy) NSString *icon; - (instancetype) initWithDict:(NSDictionary *) dict; + (instancet

26.小项目:应用市场 版本9.0

------------- CZapp.h ------------- #import <Foundation/Foundation.h> @interface CZApp : NSObject @property (nonatomic,copy) NSString *name; @property (nonatomic,copy) NSString *icon; - (instancetype) initWithDict:(NSDictionary *) dict; + (instancet

23.小项目:应用市场 版本6.0

@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); ------------- C

13.小项目:图片浏览器 版本3.0

---------------  ViewController.m  --------------- #import <Foundation/Foundation.h> #import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UILabel *indexLabel; @property (weak, nonatomic) IBOutlet UII

12.小项目:图片浏览器 版本3.0

@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); ---------------  ViewController.m  --------------- #import <Foundation/Foundation.h> #import "ViewController.h" @interf