- (instancetype)initWithImage:(nullable UIImage *)image;
根据图片初始化
- (instancetype)initWithImage:(nullable UIImage *)image highlightedImage:(nullable UIImage *)highlightedImage
根据图片和高亮图片初始化。视图默认显示图片image,在成员变量highlighted设置为YES时,显示高亮图片highlightedImage
@property (nullable, nonatomic, strong) UIImage *image;
设置和获取图片
@property (nullable, nonatomic, strong) UIImage *highlightedImage
设置和获取高亮图片
@property (nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled;
是否响应事件,默认为NO
@property (nonatomic, getter=isHighlighted) BOOL highlighted
是否显示高亮图片,默认为NO
用于动画
@property (nullable, nonatomic, copy) NSArray<UIImage *> *animationImages;
动画图片数组
@property (nullable, nonatomic, copy) NSArray<UIImage *> *highlightedAnimationImages
高亮状态下显示的动画图片数组
@property (nonatomic) NSTimeInterval animationDuration;
动画图片切换时间
@property (nonatomic) NSInteger animationRepeatCount;
动画图片重复次数。当为0时,切换次数无限。默认为0。
- (void)startAnimating;
开始播放动画
- (void)stopAnimating;
停止播放动画
@property(nonatomic, readonly, getter=isAnimating) BOOL animating;
是否在播放动画
@property (null_resettable, nonatomic, strong) UIColor *tintColor
给控件内子视图设置颜色。详细信息请见 UIImage类属性。
@property (nonatomic) BOOL adjustsImageWhenAncestorFocused
@property(readonly,strong) UILayoutGuide *focusedFrameGuide
focusedFrameGuide: 如果设置了adjustsImageWhenAncestorFocused,图像视图可以在一个更大的 frame 中显示其图片的焦点。这个布局指南,可用于将其他元素与图像视图的聚焦帧对齐。