IOS开发------图片浏览器之UIImageView中的animation

来源:互联网 发布:淘宝没发货退款要多久 编辑:程序博客网 时间:2024/06/05 02:53

本节主要讲解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


0 0
原创粉丝点击