90 lines
2.4 KiB
Objective-C
90 lines
2.4 KiB
Objective-C
//
|
|
// 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);
|
|
}];
|
|
[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) {
|
|
make.width.height.mas_equalTo(12);
|
|
make.centerY.mas_equalTo(self);
|
|
make.left.mas_equalTo(7);
|
|
}];
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
- (UIImageView *)bgImageView {
|
|
if (_bgImageView == nil) {
|
|
_bgImageView = [[UIImageView alloc] init];
|
|
_bgImageView.backgroundColor = [UIColor.whiteColor colorWithAlphaComponent:0.1];
|
|
_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
|