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

  • 相关阅读:
    常见时间复杂度及对应关系
    【转载】Locust实现集合点
    curl 查看接口的网络分段响应时间
    python-字符串操作分类小结
    Jquery--1--选择器分类
    【转】linux shell编程实例总结
    随笔分类整理
    linux备忘录-日志档案
    linux备忘录-系统服务daemon
    linux备忘录-程序管理与SELinux
  • 原文地址:https://www.cnblogs.com/ZhaoChenYang/p/9463428.html
Copyright © 2020-2023  润新知