89 lines
2.7 KiB
Objective-C
89 lines
2.7 KiB
Objective-C
//
|
|
// XPBeautIDView.m
|
|
// YuMi
|
|
//
|
|
// Created by P on 2024/8/1.
|
|
//
|
|
|
|
#import "XPBeautIDView.h"
|
|
|
|
@interface XPBeautIDView ()
|
|
|
|
@property (nonatomic, strong) UIImageView *frameImageView;
|
|
@property (nonatomic, strong) UILabel *numLabel;
|
|
@property (nonatomic, strong) UIImageView *copiedImageView;
|
|
|
|
@end
|
|
|
|
@implementation XPBeautIDView
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
[self addSubview:self.frameImageView];
|
|
[self addSubview:self.numLabel];
|
|
|
|
[self.frameImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.leading.bottom.mas_equalTo(self);
|
|
make.trailing.mas_equalTo(self);
|
|
}];
|
|
|
|
[self.numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
if (isMSRTL()) {
|
|
make.leading.mas_equalTo(self).offset(10);
|
|
make.trailing.mas_equalTo(self).offset(-46);
|
|
} else {
|
|
make.leading.mas_equalTo(self.frameImageView).offset(24);
|
|
make.trailing.mas_equalTo(self).offset(-8);
|
|
}
|
|
make.centerY.mas_equalTo(self).offset(0.8);
|
|
}];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)setNum:(NSString *)num {
|
|
_num = num;
|
|
self.numLabel.text = num;
|
|
|
|
UIImage *longBackgroundImage = kImage(@"user_info_id_beatiful_mark_short");
|
|
UIEdgeInsets capInsets = UIEdgeInsetsMake(0, 27, 0, 14);
|
|
UIImage *resizableImage = [longBackgroundImage resizableImageWithCapInsets:capInsets resizingMode:UIImageResizingModeStretch];
|
|
self.frameImageView.image = resizableImage;
|
|
}
|
|
|
|
- (UIImageView *)frameImageView {
|
|
if (!_frameImageView) {
|
|
_frameImageView = [[UIImageView alloc] init];
|
|
UIImage *longBackgroundImage = kImage(@"user_info_id_beatiful_mark_short");
|
|
UIEdgeInsets capInsets = UIEdgeInsetsMake(0, 27, 0, 14);
|
|
UIImage *resizableImage = [longBackgroundImage resizableImageWithCapInsets:capInsets resizingMode:UIImageResizingModeStretch];
|
|
_frameImageView.image = resizableImage;//Image(@"user_info_id_beatiful_mark_short");
|
|
}
|
|
return _frameImageView;
|
|
}
|
|
|
|
- (UIImageView *)copiedImageView {
|
|
if (!_copiedImageView) {
|
|
_copiedImageView = [[UIImageView alloc] init];
|
|
_copiedImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
_copiedImageView.image = kImage(@"user_card_copy_id1");
|
|
}
|
|
return _copiedImageView;
|
|
}
|
|
|
|
- (UILabel *)numLabel {
|
|
if (!_numLabel) {
|
|
_numLabel = [[UILabel alloc] init];
|
|
_numLabel.font = kFontMedium(10);
|
|
_numLabel.textAlignment = NSTextAlignmentCenter;
|
|
_numLabel.textColor = [UIColor whiteColor];
|
|
_numLabel.userInteractionEnabled = YES;
|
|
_numLabel.clipsToBounds = NO;
|
|
}
|
|
return _numLabel;
|
|
}
|
|
|
|
@end
|