Files
yinmeng-ios/xplan-ios/Main/Room/View/BaseUIContainerView/XPRoomAnchorRankEnterView.m

90 lines
2.4 KiB
Mathematica
Raw Normal View History

2022-05-12 20:18:57 +08:00
//
// XPRoomAnchorRankEnterView.m
// xplan-ios
//
// Created by GreenLand on 2022/5/12.
//
#import "XPRoomAnchorRankEnterView.h"
///Third
#import <Masonry/Masonry.h>
#import "ThemeColor.h"
///Tool
#import "NetImageView.h"
@interface XPRoomAnchorRankEnterView ()
///
@property (nonatomic, strong) UIImageView *bgImageView;
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic, strong) UIImageView *iconImageView;
@end
@implementation XPRoomAnchorRankEnterView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.bgImageView];
[self addSubview:self.titleLabel];
[self addSubview:self.iconImageView];
}
- (void)initSubViewConstraints {
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.left.right.mas_equalTo(0);
2022-05-12 20:18:57 +08:00
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.left.mas_equalTo(self.iconImageView.mas_right).mas_offset(4);
}];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
2023-03-15 20:58:43 +08:00
make.width.height.mas_equalTo(12);
2022-05-12 20:18:57 +08:00
make.centerY.mas_equalTo(self);
2023-03-16 15:32:20 +08:00
make.left.mas_equalTo(7);
2022-05-12 20:18:57 +08:00
}];
}
#pragma mark - Getters And Setters
- (UIImageView *)bgImageView {
if (_bgImageView == nil) {
_bgImageView = [[UIImageView alloc] init];
2023-03-15 20:58:43 +08:00
_bgImageView.backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:0.1];
2022-05-12 20:18:57 +08:00
_bgImageView.layer.cornerRadius = 11;
_bgImageView.layer.masksToBounds = YES;
}
return _bgImageView;
}
- (UIImageView *)iconImageView {
if (_iconImageView == nil) {
_iconImageView = [[UIImageView alloc] init];
_iconImageView.image = [UIImage imageNamed:@"anchor_hourRank_btn"];
_iconImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _iconImageView;
}
- (UILabel *)titleLabel {
if (_titleLabel == nil) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = UIColor.whiteColor;
_titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
_titleLabel.text = @"小时榜";
}
return _titleLabel;
}
@end