Files
CRBoxInputView/PodCode/Classes/CRSecrectImageView.m

66 lines
1.3 KiB
Mathematica
Raw Permalink Normal View History

2019-06-10 22:39:57 +08:00
//
// CRSecrectImageView.m
// CRBoxInputView_Example
//
// Created by Chobits on 2019/6/10.
// Copyright © 2019 BearRan. All rights reserved.
//
#import "CRSecrectImageView.h"
2019-06-11 13:44:48 +08:00
#import <Masonry/Masonry.h>
2019-06-10 22:39:57 +08:00
2019-06-11 07:59:27 +08:00
@interface CRSecrectImageView()
{
UIImageView *_lockImgView;
}
@end
2019-06-10 22:39:57 +08:00
@implementation CRSecrectImageView
- (instancetype)init
{
self = [super init];
if (self) {
[self createUI];
}
return self;
}
- (void)createUI
{
2019-06-11 07:59:27 +08:00
_lockImgView = [UIImageView new];
2019-06-10 22:39:57 +08:00
_lockImgView.image = [UIImage imageNamed:@"smallLock"];
[self addSubview:_lockImgView];
[_lockImgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.offset(0);
make.centerY.offset(0);
2019-06-11 13:44:48 +08:00
make.width.mas_equalTo(23);
make.height.mas_equalTo(27);
2019-06-10 22:39:57 +08:00
}];
}
2019-06-11 07:59:27 +08:00
#pragma mark - Setter & Getter
- (void)setImage:(UIImage *)image
{
_image = image;
_lockImgView.image = image;
}
- (void)setImageWidth:(CGFloat)imageWidth
{
_imageWidth = imageWidth;
[_lockImgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(imageWidth);
}];
}
- (void)setImageHeight:(CGFloat)imageHeight
{
_imageHeight = imageHeight;
[_lockImgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(imageHeight);
}];
}
2019-06-10 22:39:57 +08:00
@end