zoukankan      html  css  js  c++  java
  • 记录一些容易忘记的属性 -- UIImageView


        UIImage *image =  [UIImage imageNamed:@"back2.jpg"]; //创建一个图片对象,这个方法如果图片名称相同,不管我们调用多少次,得到的都是同一个图片对象。
        self.view.backgroundColor = [UIColor colorWithPatternImage:image];  //设置当前视图的背景颜色为图片的颜色。
        imageView.contentMode = UIViewContentModeScaleToFill;     //设置ImageView的内容模式

    使用下面的方法可以实现动画效果

        [UIView animateWithDuration:<#(NSTimeInterval)#> animations:^{
            <#code#>
        }];

    UIImageView实现动画效果

          //1.创建一个数组
        NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:10];
        //创建当前视图动画的图片对象,将图片对象添加到数组中
        for (int i = 1; i < 19; i++) {
            UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"DOVE %d", i]];
            [array addObject:image];
    //        imageView.animationImages
        }
        //设置动画数组
        imageView.animationImages = array;
        //设置完成一次动画所需的时间
        imageView.animationDuration = 0.5;
        //设置动画的重复次数(默认为0,0表示无限次数)
        imageView.animationRepeatCount = 0;
        //开始动画
        [imageView startAnimating];
    //    - (void)startAnimating; 开始动画
    //    - (void)stopAnimating; 停止动画
    //    - (BOOL)isAnimating; 判断动画是否在进行中

  • 相关阅读:
    LeetCode 面试题32
    LeetCode 102. 二叉树的层序遍历
    LeetCode 面试题32
    LeetCode 面试题32
    LeetCode 面试题31. 栈的压入、弹出序列
    LeetCode 946. 验证栈序列
    LeetCode 50. Pow(x, n)
    LeetCode 572. 另一个树的子树
    LeetCode 面试题50. 第一个只出现一次的字符
    LeetCode 面试题37. 序列化二叉树
  • 原文地址:https://www.cnblogs.com/goodheart/p/3990671.html
Copyright © 2011-2022 走看看