99 lines
2.8 KiB
Objective-C
99 lines
2.8 KiB
Objective-C
//
|
|
// XPGiftLuckyGiftBoradCastView.m
|
|
// xplan-ios
|
|
//
|
|
// Created by GreenLand on 2022/10/8.
|
|
//
|
|
|
|
#import "XPGiftLuckyGiftBroadcastView.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
///Tool
|
|
#import "ThemeColor.h"
|
|
|
|
@interface XPGiftLuckyGiftBroadcastView()
|
|
|
|
///背景
|
|
@property (nonatomic, strong) UIImageView *bgImageView;
|
|
///玩法说明
|
|
@property (nonatomic, strong) UIImageView *playImageView;
|
|
///icon
|
|
@property (nonatomic, strong) UIImageView *iconImageView;
|
|
|
|
@end
|
|
|
|
@implementation XPGiftLuckyGiftBroadcastView
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
self = [super initWithFrame:frame];
|
|
if (self) {
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
return self;
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
[self addSubview:self.bgImageView];
|
|
[self addSubview:self.iconImageView];
|
|
[self addSubview:self.playImageView];
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.mas_equalTo(0);
|
|
make.left.right.mas_equalTo(self).inset(10);
|
|
make.height.mas_equalTo(37);
|
|
}];
|
|
|
|
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerY.mas_equalTo(self.bgImageView);
|
|
make.left.mas_equalTo(self.bgImageView).mas_offset(8);
|
|
make.width.height.mas_equalTo(20);
|
|
}];
|
|
|
|
[self.playImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.right.bottom.mas_equalTo(self.bgImageView);
|
|
make.width.mas_equalTo(67);
|
|
}];
|
|
}
|
|
|
|
#pragma mark - action
|
|
- (void)playButtonAction:(UITapGestureRecognizer *)tap {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftLuckyGiftBroadcastViewPlayDescClick)]) {
|
|
[self.delegate xPGiftLuckyGiftBroadcastViewPlayDescClick];
|
|
}
|
|
}
|
|
|
|
- (UIImageView *)bgImageView {
|
|
if (!_bgImageView) {
|
|
_bgImageView = [[UIImageView alloc] init];
|
|
_bgImageView.image = [UIImage imageNamed:@"gift_lucky_broadcast_bg"];
|
|
_bgImageView.contentMode = UIViewContentModeScaleToFill;
|
|
}
|
|
return _bgImageView;
|
|
}
|
|
|
|
- (UIImageView *)iconImageView {
|
|
if (!_iconImageView) {
|
|
_iconImageView = [[UIImageView alloc] init];
|
|
_iconImageView.image = [UIImage imageNamed:@"gift_lucky_broadcast_icon"];
|
|
}
|
|
return _iconImageView;
|
|
}
|
|
|
|
- (UIImageView *)playImageView {
|
|
if (!_playImageView) {
|
|
_playImageView = [[UIImageView alloc] init];
|
|
_playImageView.image = [UIImage imageNamed:@"gift_lucky_broadcast_playType"];
|
|
_playImageView.contentMode = UIViewContentModeScaleToFill;
|
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(playButtonAction:)];
|
|
_playImageView.userInteractionEnabled = YES;
|
|
[_playImageView addGestureRecognizer:tap];
|
|
}
|
|
return _playImageView;
|
|
}
|
|
|
|
@end
|