1. 使用UIImageView,创建imageView;

2. 设置UIImageView 创建出来的imageView 的位置、尺寸;

3. 设置UIImageView 创建出来的imageView 的背景颜色;

4. 将UIImageView 创建出来的imageView 的加入到控制器view 中;

5. 设置显示的图片;

6. 内容模式 contentMode(一般用来控制图片如何显示):

         有aspect单词的是等比缩放

         不带Scale单词的:显示的图片一定不会被拉伸,保持图片原来的宽度和高度

 

//允许图片视图接受事件

    userInteractionEnabled ( YES 允许)(No不允许 默认);一定要先将userInteractionEnabled置为YES,这样才能响应单击事件。

    //点击手势

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(scale)];

    tap.numberOfTapsRequired = 2;//点击次数

    tap.numberOfTouchesRequired = 1; //单个手指

    [_iv addGestureRecognizer:tap];//添加手势

    //捏合手势

    UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc]initWithTarget:self action:@selector(scale:)];

    [_iv addGestureRecognizer:pinch];

    //滑动手势

    UISwipeGestureRecognizer *swip = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(test)];

    swip.direction = UISwipeGestureRecognizerDirectionRight;//滑动方向

    [_iv addGestureRecognizer:swip];

//设置图片连续播放

UIImageView *siv = [[UIImageView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:siv];

UIImage *img1 = [UIImage imageNamed:@"1"];
UIImage *img2 = [UIImage imageNamed:@"car"];
UIImage *img3 = [UIImage imageNamed:@"EditAlbum_Btn_Delete"];

siv.animationImages = @[img1,img2,img3]; //数组
siv.animationDuration = 0.5;
siv.animationRepeatCount = 20;//循环次数
[siv startAnimating];