| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- //
- // PickerImageView.m
- // 相机
- //
- //
- #import "DKPhotoPickerImageView.h"
- @interface DKPhotoPickerImageView ()
- @property (nonatomic , weak) UIView *maskView;
- @property (nonatomic , weak) UIImageView *tickImageView;
- @property (nonatomic , weak) UIImageView *videoView;
- @end
- @implementation DKPhotoPickerImageView
- - (instancetype)initWithFrame:(CGRect)frame{
- if (self = [super initWithFrame:frame]) {
- self.contentMode = UIViewContentModeScaleAspectFill;
- self.clipsToBounds = YES;
- }
- return self;
- }
- - (UIView *)maskView{
- if (!_maskView) {
- UIView *maskView = [[UIView alloc] init];
- maskView.frame = self.bounds;
- maskView.backgroundColor = [UIColor whiteColor];
- maskView.alpha = 0.5;
- maskView.hidden = YES;
- [self addSubview:maskView];
- self.maskView = maskView;
- }
- return _maskView;
- }
- - (UIImageView *)videoView{
- if (!_videoView) {
- UIImageView *videoView = [[UIImageView alloc] initWithFrame:CGRectMake(10, self.bounds.size.height - 40, 30, 30)];
- videoView.image = [UIImage imageNamed:@"video"];
- videoView.contentMode = UIViewContentModeScaleAspectFit;
- [self addSubview:videoView];
- self.videoView = videoView;
- }
- return _videoView;
- }
- - (UIImageView *)tickImageView{
- if (!_tickImageView) {
- UIImageView *tickImageView = [[UIImageView alloc] init];
- tickImageView.frame = CGRectMake(self.bounds.size.width - 40, 0, 40, 40);
- tickImageView.image = [UIImage imageNamed:@"AssetsPickerChecked"];
- tickImageView.hidden = YES;
- [self addSubview:tickImageView];
- self.tickImageView = tickImageView;
- }
- return _tickImageView;
- }
- - (void)setIsVideoType:(BOOL)isVideoType{
- _isVideoType = isVideoType;
-
- self.videoView.hidden = !(isVideoType);
- }
- - (void)setMaskViewFlag:(BOOL)maskViewFlag{
- _maskViewFlag = maskViewFlag;
-
- self.maskView.hidden = !maskViewFlag;
- self.animationRightTick = maskViewFlag;
- }
- - (void)setMaskViewColor:(UIColor *)maskViewColor{
- _maskViewColor = maskViewColor;
-
- self.maskView.backgroundColor = maskViewColor;
- }
- - (void)setMaskViewAlpha:(CGFloat)maskViewAlpha{
- _maskViewAlpha = maskViewAlpha;
-
- self.maskView.alpha = maskViewAlpha;
- }
- - (void)setAnimationRightTick:(BOOL)animationRightTick{
- _animationRightTick = animationRightTick;
- self.tickImageView.hidden = !animationRightTick;
- }
- @end
|