zoukankan      html  css  js  c++  java
  • UIImageView学习笔记

    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];

  • 相关阅读:
    8086汇编学习小记王爽汇编语言实验12
    8086汇编学习小记王爽汇编语言课程设计1
    activeMQ 持久化配置 kevin
    snmpwalk kevin
    tcp benchmark kevin
    apache camel 条件路由 kevin
    netty 并发访问测试配置 kevin
    snmp常见操作 kevin
    转发:RocketMQ与kafka的对比 kevin
    centos jdk 下载 kevin
  • 原文地址:https://www.cnblogs.com/ZhaoChenYang/p/9463428.html
Copyright © 2011-2022 走看看