UIImageView继承于UIView,是专门用来展示图片的控件。
UIImageView的创建方法:
- (instancetype)initWithImage:(nullable UIImage *)image;
- (instancetype)initWithImage:(nullable UIImage *)image highlightedImage:(nullable UIImage *)highlightedImage
UIImageView的部分属性:
//UIImageView拥有一个UIImage类型的对象,可以直接赋值一个UIImage对象
@property (nullable, nonatomic, strong) UIImage *image;
//UIImageView高亮状态下的状态也是一个UIImage类型的对象,可以直接赋值,在高亮状态下显示该image
@property (nullable, nonatomic, strong) UIImage *highlightedImage
//给UIImageView的图片展示设置一些特性
@property (nullable, nonatomic, strong) UIImageSymbolConfiguration* preferredSymbolConfiguration
//是否接受用户交互,比如点击时是否响应,默认关闭。
@property (nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled;
//设置是否为高亮状态,默认关闭。
@property (nonatomic, getter=isHighlighted) BOOL highlig