Files
peko-ios/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomDatingVipUpMicView.m
2024-04-18 18:37:21 +08:00

108 lines
2.9 KiB
Objective-C

//
// YMRoomDatingVipUpMicView.m
// YUMI
//
// Created by YUMI on 2022/1/4.
//
#import "XPRoomDatingVipUpMicView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "YUMIMacroUitls.h"
#import "DJDKMIMOMColor.h"
#import "TTPopup.h"
@interface XPRoomDatingVipUpMicView ()
///背景
@property (nonatomic,strong) UIImageView *backImageView;
///显示内容
@property (nonatomic,strong) SZTextView *contentView;
///关闭按钮
@property (nonatomic,strong) UIButton *closeButton;
@end
@implementation XPRoomDatingVipUpMicView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
for (id view in self.contentView.subviews) {
if ([view isKindOfClass:[UITextView class]]){
UITextView *textView = view;
textView.textAlignment = NSTextAlignmentLeft;
break;
}
}
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backImageView];
[self addSubview:self.contentView];
[self addSubview:self.closeButton];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(260);
make.height.mas_equalTo(325 + 55);
}];
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.top.trailing.mas_equalTo(self);
make.height.mas_equalTo(325);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(44);
make.leading.mas_equalTo(16);
make.centerX.mas_equalTo(self.backImageView);
make.height.mas_equalTo(271);
}];
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.backImageView.mas_bottom).offset(20);
make.centerX.mas_equalTo(self);
make.width.height.mas_equalTo(35);
}];
}
#pragma mark - Event Response
- (void)closeButtonAction:(UIButton *)sender {
[TTPopup dismiss];
}
#pragma mark - Getters And Setters
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.image = [UIImage getLanguageImage:@"room_mode_dating_vip_rule_bg"];
}
return _backImageView;
}
- (SZTextView *)contentView {
if (!_contentView) {
_contentView = [[SZTextView alloc] init];
_contentView.text = YMLocalizedString(@"XPRoomDatingVipUpMicView0");
_contentView.backgroundColor = [UIColor clearColor];
_contentView.textColor = UIColorFromRGB(0xFFF9BC);
_contentView.font = [UIFont systemFontOfSize:12];
}
return _contentView;
}
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [[UIButton alloc] init];
[_closeButton setImage:[UIImage imageNamed:@"room_mode_dating_alert_close"] forState:UIControlStateNormal];
[_closeButton addTarget:self action:@selector(closeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _closeButton;
}
@end