UIImageView常用属性和方法

来源:互联网 发布:阳炎ene软件 编辑:程序博客网 时间:2024/04/29 21:46

一、常用属性

1、image: default is nil。图片属性

2、highlightedImage: default is nil。高亮状态图片属性


3、userInteractionEnabled: default is NO。用户是否可以交互属性


4、highlighted: default is NO。判断图片是否是高亮状态


these allow a set of images to be animated. the array may contain multiple copies of the same(下面属性允许图像组动画,该数组内可能包含相同的多个副本)

5、animationImages: The array must contain UIImages. Setting hides the single image. default is nil。该数组当中必须包含多张图片,设置单张图片将被隐藏,默认 nil

@property (nullable, nonatomic, copy) NSArray<UIImage *> *animationImages;


6、highlightedAnimationImages: The array must contain UIImages. Setting hides the single image. default is nil.高亮状态的组动画。


7、animationDuration: for one cycle of images. default is number of images * 1/30th of a second (i.e. 30 fps)。动画播放时间,对于一个周期的图像,默认的是图像是一秒30帧。

@property (nonatomic) NSTimeInterval animationDuration;


8、animationRepeatCount: 0 means infinite (default is 0)。动画循环次数。0意味着无限(默认0)。

@property (nonatomic) NSInteger      animationRepeatCount;


9、tintColor: 给控件内子视图设置颜色。详细信息请见 UIImage类属性。


10、focusedFrameGuide: if adjustsImageWhenAncestorFocused is set, the image view may display its image in a larger frame when focused.this layout guide can be used to align other elements with the image view's focused frame.如果设置了adjustsImageWhenAncestorFocused,图像视图可以在一个更大的 frame 中显示其图片的焦点。这个布局指南,可用于将其他元素与图像视图的聚焦帧对齐。

@property(readonly,strong) UILayoutGuide *focusedFrameGuide;



二、常用方法

1、initWithImage::构造方法,在初始化对象时直接进行默认图片进行赋值。

- (instancetype)initWithImage: (nullable UIImage *)image;


2、initWithImage:highlightedImage:: 构造方法,在初始化对象时直接给默认和高亮图片进行赋值

- (instancetype)initWithImage: (nullable UIImage *)image highlightedImage: (nullable UIImage *)highlightedImage;


3、startAnimating::开始动画

- (void)startAnimating;


4、stopAnimating::结束动画

- (void)stopAnimating;


5、isAnimating:: 动画中

- (BOOL)isAnimating;


0 0