IOS开发------图片浏览器之UIImageView中的animation
2014-10-13 23:18
302 查看
本节主要讲解UIImageView中的动画操作:
常用的几个方法的名称:
①setAnimationImages:设置动画的图片,参数为数组NSArray
②setAnimationDuration:设置时间间隔,参数为浮点数
③setAnimationRepeatCount:设置重复次数
④startAnimating:动画开始
⑤stopAnimating:结束动画
ViewController.h文件
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *zhaoyunImage;
@end
ViewController.m文件
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSMutableArray *array = [NSMutableArray array];
for (int i = 1; i <= 10; ++i) {
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png",i]];
[array addObject:image];
}
[_zhaoyunImage setAnimationImages:array];
[_zhaoyunImage setAnimationDuration:1.0];
[_zhaoyunImage setAnimationRepeatCount:100];
[_zhaoyunImage startAnimating];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
常用的几个方法的名称:
①setAnimationImages:设置动画的图片,参数为数组NSArray
②setAnimationDuration:设置时间间隔,参数为浮点数
③setAnimationRepeatCount:设置重复次数
④startAnimating:动画开始
⑤stopAnimating:结束动画
ViewController.h文件
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *zhaoyunImage;
@end
ViewController.m文件
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSMutableArray *array = [NSMutableArray array];
for (int i = 1; i <= 10; ++i) {
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png",i]];
[array addObject:image];
}
[_zhaoyunImage setAnimationImages:array];
[_zhaoyunImage setAnimationDuration:1.0];
[_zhaoyunImage setAnimationRepeatCount:100];
[_zhaoyunImage startAnimating];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
相关文章推荐
- iOS开发笔记--UIImageView的属性之animationImages详解
- iOS开发笔记--UIImageView的属性之animationImages详解
- IOS开发--给UIImageView添加touch事件
- iOS开发>>>UIImageView连续播放图片,组成动画
- ios开发 - UIImageView 的contentMode属性应用
- 【iOS开发-9】UIImage和UIImageView属性介绍,实现图片动画,实现开始/停止按钮效果
- 学习IOS开发UI篇--UI知识点总结(二) UILabel/UIImageView
- iOS开发26:UIImageView常用操作
- iOS开发的一些小技术:让UIImage有缩放功能、控制log的输出、xcode修改文件注释、随机数的使用、在UIImageView 中旋转图像、在Quartz中如何设置旋转点、创建.plist文件并存储
- 学习IOS开发UI篇--UIView\UIButton\UILabel\UIImageView\UITextField
- ios开发-UIImageView适配图片大小
- iOS开发:UIImageView常用操作
- iOS开发26:UIImageView常用操作
- IOS开发--给UIImageView添加touch事件
- ios--UIImageView的属性之animationImages详解
- IOS开发(17)之UIImageView控件
- iOS开发:结合UIImageView实…
- IOS开发-给UIImageView赋无限循环动画
- iOS开发笔记--异步加载UIImageView----AsyImageView
- iOS开发UI篇—在UIImageView中添加按钮以及Tag的参数说明