107 lines
2.6 KiB
Objective-C
107 lines
2.6 KiB
Objective-C
//
|
|
// YMRoomRankEntranceView.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2022/4/27.
|
|
//
|
|
|
|
#import "XPRoomRankEntranceView.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
#import "DJDKMIMOMColor.h"
|
|
///Tool
|
|
#import "NetImageView.h"
|
|
|
|
@interface XPRoomRankEntranceView ()
|
|
|
|
///背景图
|
|
@property (nonatomic, strong) UIView *bgView;
|
|
///礼物值
|
|
@property (nonatomic, strong) UILabel *titleLabel;
|
|
///箭头图标
|
|
@property (nonatomic, strong) UIImageView *iconImageView;
|
|
|
|
@end
|
|
|
|
@implementation XPRoomRankEntranceView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
if (self = [super initWithFrame:frame]) {
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
[self addSubview:self.bgView];
|
|
[self.bgView addSubview:self.titleLabel];
|
|
[self.bgView addSubview:self.iconImageView];
|
|
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.bottom.trailing.leading.equalTo(self);
|
|
|
|
}];
|
|
|
|
[self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.mas_equalTo(self.bgView);
|
|
make.leading.mas_equalTo(26);
|
|
make.trailing.mas_equalTo(-4);
|
|
}];
|
|
[self.iconImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(18);
|
|
make.height.mas_equalTo(15);
|
|
make.centerY.mas_equalTo(self.bgView);
|
|
make.leading.mas_equalTo(5);
|
|
}];
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
- (void)setTitle:(NSString *)title {
|
|
self.titleLabel.text = title;
|
|
}
|
|
|
|
- (void)setArray:(NSArray *)array {
|
|
|
|
}
|
|
|
|
- (UIView *)bgView {
|
|
if (_bgView == nil) {
|
|
_bgView = [[UIView alloc] init];
|
|
_bgView.backgroundColor = UIColorRGBAlpha(0xFFFFFF, 0.2);
|
|
_bgView.layer.cornerRadius = 12;
|
|
_bgView.layer.masksToBounds = YES;
|
|
}
|
|
return _bgView;
|
|
}
|
|
|
|
|
|
|
|
- (UIImageView *)iconImageView {
|
|
if (_iconImageView == nil) {
|
|
_iconImageView = [[UIImageView alloc] init];
|
|
_iconImageView.image = [[UIImage imageNamed:@"room_rank_iocn"]ms_SetImageForRTL];
|
|
_iconImageView.contentMode = UIViewContentModeScaleAspectFit;
|
|
|
|
}
|
|
return _iconImageView;
|
|
}
|
|
|
|
- (UILabel *)titleLabel {
|
|
if (_titleLabel == nil) {
|
|
_titleLabel = [[UILabel alloc] init];
|
|
_titleLabel.textColor = [UIColor colorWithWhite:1 alpha:0.8];
|
|
_titleLabel.font = [UIFont systemFontOfSize:9 weight:UIFontWeightBold];
|
|
_titleLabel.text = YMLocalizedString(@"XPRoomRankEntranceView0");
|
|
_titleLabel.numberOfLines = 2;
|
|
}
|
|
return _titleLabel;
|
|
}
|
|
|
|
|
|
@end
|