用UIImgeView播放gif图
2015-09-19 09:13
375 查看
RootViewController.m #import "RootViewController.h" @interface RootViewController () 1.创建一个UIImageView的属性. @property(nonatomic, retain)UIImageView *imageView; @end @implementation RootViewController - (void)dealloc { [_imageView release]; [super dealloc]; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor = [UIColor whiteColor]; 2.创建一个UIImageView. self.imageView = [UIImageView alloc] initWithFrame:CGRectMake(100, 100, 200, 200); [self.view addSubview:self.imageView]; [_imageView release]; 3.创建一个可变数组. NSMutableArray *picArray = [NSMutableArray array]; 4.遍历图片张数,有多少张遍历多少次. for (NSInteger i = 0; i < 40; i++) { 5.做一次打印,使用02ld占位. NSLog(@"%02ld", i); 6.拼接图片名,找到对应的图片位置. NSString *imageName = [NSString stringWithFormat:@"eat_%02ld.jpg", i]; 7.打印图片名称,验证图片名是否以拼接完成. NSLog(@"%@", imageName); 8.将拼接好的图片放入UIImage类的对象中. UIImage *image = [UIImage imageNamed:imageName]; 9.将UIImage对象,放入数组中. [picArray addObject:image]; } 10.确定要播放动画的数组. self.imageView.animationImages = picArray; 11.动画的持续时间. self.imageView.animationDuration = 0.1; 12.动画播放的重复. self.imageView.animationRepeatCount = 0; 13.动画开始播放. [self.imageView startAnimation]; }
相关文章推荐
- phpcmsv9更改fckeditor编者ueditor编辑
- 3 sequence containers in STL
- OS每天15个注意点系列之UI-界面布局
- uva 540(Team Queue)
- easyUi 教程资料分享
- UITableView判断reloadData结束(iOS)
- hdoj 3836 Equivalent Sets【scc&&缩点】【求最少加多少条边使图强连通】
- String,StringBuffer,StringBuilder
- UITabBarController笔记(UITabBar/UITabBarButton)
- 从一个登陆页跳转到一个具有多个导航页面的工具栏控制器UITabbarController中
- Android中全局搜索(QuickSearchBox)详解
- 理解newid()和newsequentialid()
- easyUI——datagrid的动态显示和隐藏
- iOS UI基础-9.2 UITableView 简单微博列表
- iOS UIImageRenderingMode
- [DLX]HDOJ4069 Squiggly Sudoku
- 交互设计必懂--开发有价值的用户体验
- 增加用户体验的细节--三个按钮的交互设计思维
- 零基础掌握交互设计的重点笔记
- UI_UISegmentedControl