zoukankan      html  css  js  c++  java
  • iOS开篇——UI之UIImageView

    创建一个UIImageView

        //创建UIImageView 根据图片大小
        UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(50, 80, size.width, size.height)];

    用一个UIImage类型的对象给UIImageView的image属性赋值

        //设置imageView的图片
        imageView.image = image;
    //    //UIImageView的填充模式
        imageView.contentMode = UIViewContentModeScaleAspectFill;
        
        
        /*
         typedef NS_ENUM(NSInteger, UIViewContentMode) {
         UIViewContentModeScaleToFill,    //直接填充
         UIViewContentModeScaleAspectFit,     按比例填充 // contents scaled to fit with fixed aspect. remainder is transparent
         UIViewContentModeScaleAspectFill,     根据frame填充// contents scaled to fill with fixed aspect. some portion of content may be clipped.
         UIViewContentModeRedraw,              // redraw on bounds change (calls -setNeedsDisplay)
         UIViewContentModeCenter,              // contents remain same size. positioned adjusted.
         UIViewContentModeTop,
         UIViewContentModeBottom,
         UIViewContentModeLeft,
         UIViewContentModeRight,
         UIViewContentModeTopLeft,
         UIViewContentModeTopRight,
         UIViewContentModeBottomLeft,
         UIViewContentModeBottomRight,
         };
         */

    UIImageView播放动画

        //设置imageView的动画数组 存的UIImage类的对象
        imageView.animationImages = array;
        //设置动画时间  播放一轮的时间
        imageView.animationDuration = 1;
        //设置动画执行次数 0表示无数次
        imageView.animationRepeatCount = 0;
        
        //开启动画
        [imageView startAnimating];
  • 相关阅读:
    Google Analytics的Gif请求数据解读
    还原当年创业:屌丝逆袭后的华丽转身 (zz)
    减去脂肪,轻身上阵 (zz)
    离婚,感谢 (转载)
    delphi如何调用.NET webservice
    如何修改远程登陆3389端口
    软件中的2038问题讨论
    去掉cxgrid上面的分组的灰色栏
    从MDF文件恢复Sql Server2000数据库
    CxGrid的一些使用方法
  • 原文地址:https://www.cnblogs.com/gwkiOS/p/4979600.html
Copyright © 2011-2022 走看看