增加换肤功能
This commit is contained in:
31
QXLive/Tabbar/弹窗/QXAlertView.h
Normal file
31
QXLive/Tabbar/弹窗/QXAlertView.h
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// QXAlertView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/3.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 删除动态
|
||||
QXAlertViewTypeDeleteDynamic = 0,
|
||||
/// 删除评论
|
||||
QXAlertViewTypeDeleteComment,
|
||||
/// 发起点歌
|
||||
QXAlertViewTypeApplySong,
|
||||
/// 同意点歌
|
||||
QXAlertViewTypeAgreeSong,
|
||||
/// pk弹窗
|
||||
QXAlertViewTypeAgreePK,
|
||||
}QXAlertViewType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAlertView : UIView
|
||||
@property (nonatomic,assign)QXAlertViewType type;
|
||||
@property (nonatomic,assign)NSString *message;
|
||||
@property (nonatomic,assign)NSString *title;
|
||||
@property (nonatomic,copy)void(^commitBlock)(void);
|
||||
@property (nonatomic,copy)void(^cancelBlock)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
152
QXLive/Tabbar/弹窗/QXAlertView.m
Normal file
152
QXLive/Tabbar/弹窗/QXAlertView.m
Normal file
@@ -0,0 +1,152 @@
|
||||
//
|
||||
// QXAlertView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/3.
|
||||
//
|
||||
|
||||
#import "QXAlertView.h"
|
||||
#import "QXTimer.h"
|
||||
|
||||
@interface QXAlertView()
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *cancelBtn;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@end
|
||||
@implementation QXAlertView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
[self addRoundedCornersWithRadius:16];
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.text = QXText(@"提示");
|
||||
self.titleLabel.textColor = RGB16(0x333333);
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self).offset(16);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.messageLabel.text = QXText(@"确定要删除此评论吗?");
|
||||
self.messageLabel.textColor = RGB16(0x000000);
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
[self addSubview:self.messageLabel];
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.left.equalTo(self).offset(16);
|
||||
make.right.equalTo(self).offset(-16);
|
||||
make.centerY.equalTo(self);
|
||||
}];
|
||||
|
||||
|
||||
self.commitBtn = [[UIButton alloc] init];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.commitBtn setTitle:QXText(@"确认") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.commitBtn];
|
||||
[self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(ScaleWidth(110));
|
||||
make.right.mas_equalTo(-20);
|
||||
}];
|
||||
|
||||
|
||||
self.cancelBtn = [[UIButton alloc] init];
|
||||
[self.cancelBtn addRoundedCornersWithRadius:21];
|
||||
self.cancelBtn.backgroundColor = RGB16(0xF3F3F3);
|
||||
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
|
||||
[self.cancelBtn setTitleColor:RGB16(0x999999) forState:(UIControlStateNormal)];
|
||||
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.cancelBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.cancelBtn];
|
||||
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(ScaleWidth(110));
|
||||
make.left.mas_equalTo(20);
|
||||
}];
|
||||
}
|
||||
-(void)setType:(QXAlertViewType)type{
|
||||
_type = type;
|
||||
switch (type) {
|
||||
case QXAlertViewTypeDeleteDynamic:
|
||||
self.messageLabel.text = QXText(@"确定要删除此动态吗?");
|
||||
break;
|
||||
case QXAlertViewTypeDeleteComment:
|
||||
self.messageLabel.text = QXText(@"确定要删除此评论吗?");
|
||||
break;
|
||||
case QXAlertViewTypeApplySong:
|
||||
self.messageLabel.text = QXText(@"您将要发起点歌申请");
|
||||
break;
|
||||
case QXAlertViewTypeAgreeSong:
|
||||
case QXAlertViewTypeAgreePK:{
|
||||
MJWeakSelf
|
||||
[self.cancelBtn setTitle:QXText(@"拒绝") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitle:QXText(@"同意") forState:(UIControlStateNormal)];
|
||||
__block int timeCount = 10;
|
||||
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
|
||||
timeCount--;
|
||||
if (timeCount<=0) {
|
||||
[self->_timer invalidate];
|
||||
[weakSelf cancelAction];
|
||||
}else{
|
||||
[self->_cancelBtn setTitle:[NSString stringWithFormat:@"%@(%d)",QXText(@"拒绝"),timeCount] forState:(UIControlStateNormal)];
|
||||
}
|
||||
}];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
-(void)setMessage:(NSString *)message{
|
||||
self.messageLabel.text = message;
|
||||
}
|
||||
-(void)setTitle:(NSString *)title{
|
||||
_title = title;
|
||||
self.titleLabel.text = title;
|
||||
}
|
||||
-(void)cancelAction{
|
||||
if (_timer) {
|
||||
[self->_timer invalidate];
|
||||
_timer = nil;
|
||||
}
|
||||
MJWeakSelf
|
||||
[[QXGlobal shareGlobal] hideViewBlock:^{
|
||||
if (weakSelf.cancelBlock) {
|
||||
weakSelf.cancelBlock();
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)commitAction{
|
||||
if (_timer) {
|
||||
[self->_timer invalidate];
|
||||
_timer = nil;
|
||||
}
|
||||
MJWeakSelf
|
||||
[[QXGlobal shareGlobal] hideViewBlock:^{
|
||||
if (weakSelf.commitBlock) {
|
||||
weakSelf.commitBlock();
|
||||
}
|
||||
}];
|
||||
}
|
||||
@end
|
||||
18
QXLive/Tabbar/弹窗/QXChirldPopView.h
Normal file
18
QXLive/Tabbar/弹窗/QXChirldPopView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXChirldPopView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXChirldPopView : UIView
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^gotoActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^setActionBlock)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
128
QXLive/Tabbar/弹窗/QXChirldPopView.m
Normal file
128
QXLive/Tabbar/弹窗/QXChirldPopView.m
Normal file
@@ -0,0 +1,128 @@
|
||||
//
|
||||
// QXChirldPopView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/8.
|
||||
//
|
||||
|
||||
#import "QXChirldPopView.h"
|
||||
@interface QXChirldPopView()
|
||||
@property (nonatomic,strong)UIImageView*bgImageView;
|
||||
@property (nonatomic,strong)UILabel*titleLabel;
|
||||
@property (nonatomic,strong)UILabel*contentLabel;
|
||||
@property (nonatomic,strong)UIButton*goBtn;
|
||||
@property (nonatomic,strong)UIButton*closeBtn;
|
||||
@property (nonatomic,strong)UIButton *setBtn;
|
||||
@end
|
||||
|
||||
@implementation QXChirldPopView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, ScaleWidth(275), ScaleWidth(365+48));
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubViews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_chirld_mode"]];
|
||||
[self addSubview:self.bgImageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = QXConfig.textColor;
|
||||
self.titleLabel.text = QXText(@"青少年模式");
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.titleLabel];
|
||||
|
||||
self.contentLabel = [[UILabel alloc] init];
|
||||
self.contentLabel.numberOfLines = 0;
|
||||
self.contentLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.contentLabel.textColor = RGB16(0x666666);
|
||||
self.contentLabel.text = QXText(@"为了呵护未成年人健康成长,蜜耳语音特别推出青少年模式,该模式下部分功能无法正常使用,请监护人主动选择并设置监护密码");
|
||||
[self addSubview:self.contentLabel];
|
||||
|
||||
self.goBtn = [[UIButton alloc] init];
|
||||
[self.goBtn setTitleColor:RGB16(0xF4DF39) forState:(UIControlStateNormal)];
|
||||
[self.goBtn setTitle:[NSString stringWithFormat:@"%@>",QXText(@"进入青少年模式")] forState:(UIControlStateNormal)];
|
||||
self.goBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.goBtn addTarget:self action:@selector(gotoChirld) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.goBtn];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.centerX.equalTo(self);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(275), ScaleWidth(365)));
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self);
|
||||
make.top.mas_equalTo(ScaleWidth(163));
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self).offset(13);
|
||||
make.right.equalTo(self).offset(-13);
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(10);
|
||||
}];
|
||||
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).offset(8);
|
||||
make.height.width.mas_equalTo(30);
|
||||
}];
|
||||
//
|
||||
[self.goBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.height.mas_equalTo(30);
|
||||
make.bottom.equalTo(self.bgImageView.mas_bottom).offset(-55);
|
||||
}];
|
||||
|
||||
self.setBtn = [[UIButton alloc] init];
|
||||
[self.setBtn addRoundedCornersWithRadius:21];
|
||||
self.setBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.setBtn setTitle:QXText(@"设置青少年模式") forState:(UIControlStateNormal)];
|
||||
[self.setBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.setBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.setBtn addTarget:self action:@selector(setAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.setBtn];
|
||||
[self.setBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgImageView).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.right.equalTo(self.bgImageView).offset(-48);
|
||||
make.left.equalTo(self.bgImageView).offset(48);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)gotoChirld{
|
||||
if (self.gotoActionBlock) {
|
||||
self.gotoActionBlock();
|
||||
}
|
||||
}
|
||||
-(void)closeAction{
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setAction{
|
||||
if (self.setActionBlock) {
|
||||
self.setActionBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
19
QXLive/Tabbar/弹窗/QXFirstRechargePopView.h
Normal file
19
QXLive/Tabbar/弹窗/QXFirstRechargePopView.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXFirstRechargePopView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXFirstRechargePopView : UIView
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^rechargeActionBlock)(NSString*money);
|
||||
@property (nonatomic,strong)NSArray *giftArray;
|
||||
-(void)reloadData;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
310
QXLive/Tabbar/弹窗/QXFirstRechargePopView.m
Normal file
310
QXLive/Tabbar/弹窗/QXFirstRechargePopView.m
Normal file
@@ -0,0 +1,310 @@
|
||||
//
|
||||
// QXFirstRechargePopView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import "QXFirstRechargePopView.h"
|
||||
#import "GKPageControl.h"
|
||||
#import <NSAttributedString+YYText.h>
|
||||
#import "QXGiftCell.h"
|
||||
#import "QXHomePageNetwork.h"
|
||||
|
||||
@interface QXFirstRechargePopView()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIImageView *lightBgImageView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *priceLabel;
|
||||
|
||||
@property (nonatomic,strong)UIButton *firstBtn;
|
||||
@property (nonatomic,strong)UIButton *secondBtn;
|
||||
@property (nonatomic,strong)UIButton *thirdBtn;
|
||||
@property (nonatomic,strong)UIButton *selectedBtn;
|
||||
|
||||
@property (nonatomic,strong)UIView *giftBgView;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)GKPageControl *pageControl;
|
||||
@property (nonatomic,strong)UIButton *getBtn;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *md1;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *md2;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *md3;
|
||||
@property (nonatomic,strong)QXFirstRechargeModel *smd;
|
||||
@end
|
||||
|
||||
@implementation QXFirstRechargePopView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(582));
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.lightBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_bg"]];
|
||||
[self addSubview:self.lightBgImageView];
|
||||
[self.lightBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_first_recharge"]];
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(275), ScaleWidth(338)));
|
||||
}];
|
||||
|
||||
self.priceLabel = [[UILabel alloc] init];
|
||||
// self.priceLabel.attributedText =
|
||||
[self addSubview:self.priceLabel];
|
||||
[self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.bgImageView).offset(ScaleWidth(98));
|
||||
make.left.equalTo(self.bgImageView).offset(ScaleWidth(119));
|
||||
make.height.mas_equalTo(ScaleWidth(20));
|
||||
make.right.equalTo(self.bgImageView).offset(-5);
|
||||
}];
|
||||
|
||||
self.firstBtn = [[UIButton alloc] init];
|
||||
self.firstBtn.hidden = YES;
|
||||
UIImage *firstNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
|
||||
UIImage *firstSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
|
||||
[self.firstBtn setBackgroundImage:firstNorImage forState:(UIControlStateNormal)];
|
||||
[self.firstBtn setBackgroundImage:firstSelImage forState:(UIControlStateSelected)];
|
||||
self.firstBtn.selected = YES;
|
||||
// [self.firstBtn setTitle:@"9元" forState:(UIControlStateNormal)];
|
||||
[self.firstBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
[self.firstBtn addRoundedCornersWithRadius:ScaleWidth(13)];
|
||||
self.firstBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.firstBtn addTarget:self action:@selector(rechargeSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.selectedBtn = self.firstBtn;
|
||||
[self addSubview:self.firstBtn];
|
||||
[self.firstBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.bgImageView).offset(ScaleWidth(24));
|
||||
make.top.equalTo(self.priceLabel.mas_bottom).offset(ScaleWidth(11));
|
||||
make.height.mas_equalTo(ScaleWidth(26));
|
||||
make.width.mas_equalTo(ScaleWidth(42));
|
||||
}];
|
||||
|
||||
self.secondBtn = [[UIButton alloc] init];
|
||||
self.secondBtn.hidden = YES;
|
||||
UIImage *secondNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
|
||||
UIImage *secondSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
|
||||
[self.secondBtn setBackgroundImage:secondNorImage forState:(UIControlStateNormal)];
|
||||
[self.secondBtn setBackgroundImage:secondSelImage forState:(UIControlStateSelected)];
|
||||
// [self.secondBtn setTitle:@"30元" forState:(UIControlStateNormal)];
|
||||
[self.secondBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
[self.secondBtn addRoundedCornersWithRadius:ScaleWidth(13)];
|
||||
self.secondBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.secondBtn addTarget:self action:@selector(rechargeSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.secondBtn];
|
||||
[self.secondBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.firstBtn.mas_right).offset(12);
|
||||
make.top.equalTo(self.firstBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(26));
|
||||
make.width.mas_equalTo(ScaleWidth(42));
|
||||
}];
|
||||
|
||||
|
||||
self.thirdBtn = [[UIButton alloc] init];
|
||||
self.thirdBtn.hidden = YES;
|
||||
UIImage *thirdNorImage = [UIImage imageWithColor:RGB16(0xFFFFFF)];
|
||||
UIImage *thirdSelImage = [UIImage imageWithColor:RGB16(0xF4DF39)];
|
||||
[self.thirdBtn setBackgroundImage:thirdNorImage forState:(UIControlStateNormal)];
|
||||
[self.thirdBtn setBackgroundImage:thirdSelImage forState:(UIControlStateSelected)];
|
||||
// [self.thirdBtn setTitle:@"60元" forState:(UIControlStateNormal)];
|
||||
[self.thirdBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
[self.thirdBtn addRoundedCornersWithRadius:ScaleWidth(13)];
|
||||
self.thirdBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.thirdBtn addTarget:self action:@selector(rechargeSelectedAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.thirdBtn];
|
||||
[self.thirdBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.secondBtn.mas_right).offset(12);
|
||||
make.top.equalTo(self.firstBtn);
|
||||
make.height.mas_equalTo(ScaleWidth(26));
|
||||
make.width.mas_equalTo(ScaleWidth(42));
|
||||
}];
|
||||
|
||||
self.giftBgView = [[UIView alloc] init];
|
||||
self.giftBgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.giftBgView addRoundedCornersWithRadius:13];
|
||||
[self addSubview:self.giftBgView];
|
||||
[self.giftBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.firstBtn.mas_bottom).offset(ScaleWidth(12));
|
||||
make.left.equalTo(self.bgImageView).offset(24);
|
||||
make.right.equalTo(self.bgImageView).offset(-24);
|
||||
make.height.mas_equalTo(108);
|
||||
}];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake((ScaleWidth(275)-24*2-3*8-12*2)/4, ScaleWidth(76));
|
||||
layout.minimumLineSpacing = 8;
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
[self.collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
// self.collectionView.pagingEnabled = YES;
|
||||
[self.giftBgView addSubview:self.collectionView];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.top.mas_equalTo(12);
|
||||
make.height.mas_equalTo(ScaleWidth(76));
|
||||
make.right.mas_equalTo(-12);
|
||||
}];
|
||||
|
||||
_pageControl = [[GKPageControl alloc] init];
|
||||
_pageControl.style = GKPageControlStyleRectangle;
|
||||
_pageControl.dotWidth = 15;
|
||||
_pageControl.dotHeight = 5;
|
||||
_pageControl.dotMargin = 2;
|
||||
_pageControl.hidden = YES;
|
||||
_pageControl.pageIndicatorTintColor = RGB16(0xEBEBEB);
|
||||
_pageControl.currentPageIndicatorTintColor = QXConfig.textColor;
|
||||
[self.giftBgView addSubview:self.pageControl];
|
||||
[self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.collectionView.mas_bottom).offset(3);
|
||||
make.height.mas_equalTo(5);
|
||||
make.right.mas_equalTo(-48);
|
||||
make.left.mas_equalTo(48);
|
||||
}];
|
||||
|
||||
self.getBtn = [[UIButton alloc] init];
|
||||
[self.getBtn addRoundedCornersWithRadius:21];
|
||||
self.getBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.getBtn setTitle:QXText(@"立即充值") forState:(UIControlStateNormal)];
|
||||
[self.getBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.getBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.getBtn addTarget:self action:@selector(rechargeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.getBtn];
|
||||
[self.getBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgImageView).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.right.equalTo(self.bgImageView).offset(-48);
|
||||
make.left.equalTo(self.bgImageView).offset(48);
|
||||
}];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).offset(8);
|
||||
make.height.width.mas_equalTo(30);
|
||||
}];
|
||||
[self getFirstRechargeGiftList];
|
||||
}
|
||||
-(void)reloadData{
|
||||
[self getFirstRechargeGiftList];
|
||||
}
|
||||
-(void)getFirstRechargeGiftList{
|
||||
MJWeakSelf
|
||||
[QXHomePageNetwork getFirstRechargeGiftListSuccessBlock:^(NSArray<QXFirstRechargeModel *> * _Nonnull list) {
|
||||
for (int i = 0; i<list.count; i++) {
|
||||
if (i == 0) {
|
||||
weakSelf.md1 = list[i];
|
||||
weakSelf.firstBtn.hidden = NO;
|
||||
[weakSelf.firstBtn setTitle:weakSelf.md1.name forState:(UIControlStateNormal)];
|
||||
continue;
|
||||
}
|
||||
if (i == 1) {
|
||||
weakSelf.md2 = list[i];
|
||||
weakSelf.secondBtn.hidden = NO;
|
||||
[weakSelf.secondBtn setTitle:weakSelf.md2.name forState:(UIControlStateNormal)];
|
||||
continue;
|
||||
}
|
||||
if (i == 2) {
|
||||
weakSelf.md3 = list[i];
|
||||
weakSelf.thirdBtn.hidden = NO;
|
||||
[weakSelf.thirdBtn setTitle:weakSelf.md3.name forState:(UIControlStateNormal)];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
[weakSelf rechargeSelectedAction:weakSelf.firstBtn];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
|
||||
if ([scrollView isKindOfClass:[UICollectionView class]]) {
|
||||
long offsetX = (long)scrollView.contentOffset.x;
|
||||
int width = ScaleWidth(275-15*2-12*2-3*8);
|
||||
int remainder = offsetX % width;
|
||||
NSInteger index;
|
||||
if (remainder>(width)/2) {
|
||||
index = offsetX/width+1;
|
||||
}else{
|
||||
index = offsetX/width;
|
||||
}
|
||||
self.pageControl.currentPage = index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-(void)setGiftArray:(NSArray *)giftArray{
|
||||
// _giftArray = giftArray;
|
||||
// self.pageControl.numberOfPages = giftArray.count/4+1;
|
||||
// self.pageControl.currentPage = 0;
|
||||
// [self.collectionView reloadData];
|
||||
//}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.giftArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
|
||||
cell.roomGiftModel = self.giftArray[indexPath.row];
|
||||
cell.cellType = QXGiftCellTypeNiceGift;
|
||||
return cell;
|
||||
}
|
||||
-(void)rechargeSelectedAction:(UIButton*)sender{
|
||||
self.selectedBtn.selected = !self.selectedBtn.selected;
|
||||
sender.selected = !sender.selected;
|
||||
self.selectedBtn = sender;
|
||||
QXFirstRechargeModel *md = nil;
|
||||
if (sender == self.firstBtn) {
|
||||
md = self.md1;
|
||||
self.giftArray = self.md1.gift_list;
|
||||
}else if (sender == self.secondBtn){
|
||||
self.giftArray = self.md2.gift_list;
|
||||
md = self.md2;
|
||||
}else if (sender == self.thirdBtn){
|
||||
self.giftArray = self.md3.gift_list;
|
||||
md = self.md3;
|
||||
}
|
||||
self.smd = md;
|
||||
if (md == nil) {
|
||||
return;
|
||||
}
|
||||
NSAttributedString *attr = [self changePrice:md.title1 giftPrice:md.title2];
|
||||
self.priceLabel.attributedText = attr;
|
||||
self.pageControl.numberOfPages = self.giftArray.count/4+1;
|
||||
self.pageControl.currentPage = 0;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
-(NSAttributedString *)changePrice:(NSString*)price giftPrice:(NSString*)giftPrice{
|
||||
NSString *str = [NSString stringWithFormat:@"%@ %@",price,giftPrice];
|
||||
NSAttributedString *attr = [str deleteLineWithTextColor:RGB16(0x999999) lineColor:RGB16(0x999999) range:[str rangeOfString:giftPrice]];
|
||||
NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithAttributedString:attr];
|
||||
[att yy_setFont:[UIFont systemFontOfSize:14] range:[str rangeOfString:price]];
|
||||
[att yy_setFont:[UIFont systemFontOfSize:12] range:[str rangeOfString:giftPrice]];
|
||||
[att yy_setColor:RGB16(0x333333) range:[price rangeOfString:str]];
|
||||
return att;
|
||||
}
|
||||
-(void)rechargeAction{
|
||||
if (self.rechargeActionBlock) {
|
||||
self.rechargeActionBlock(self.smd.money);
|
||||
}
|
||||
}
|
||||
-(void)closeAction{
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
42
QXLive/Tabbar/弹窗/QXGiftCell.h
Normal file
42
QXLive/Tabbar/弹窗/QXGiftCell.h
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// QXGiftCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXGiftModel.h"
|
||||
#import "QXUserModel.h"
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
/// 天降好礼
|
||||
QXGiftCellTypeNiceGift = 0,
|
||||
/// 背包
|
||||
QXGiftCellTypeBackpack,
|
||||
/// 直播间
|
||||
QXGiftCellTypeLive,
|
||||
/// 礼物墙
|
||||
QXGiftCellTypeGiftWall,
|
||||
}QXGiftCellType;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXGiftCell : UICollectionViewCell
|
||||
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *gitfImageView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *giftNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *cornBtn;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *numberHeightConstraint;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *selecteBtn;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *nameLabelHeight;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *cornHeight;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *numberWidthConstraint;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *userHeaderView;
|
||||
@property (weak, nonatomic) IBOutlet UIView *numberBgView;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *grayCoverView;
|
||||
|
||||
@property (strong, nonatomic) QXGiftModel *roomGiftModel;
|
||||
@property (strong, nonatomic) QXUserGiftWallModel *giftWall;
|
||||
@property (assign, nonatomic) QXGiftCellType cellType;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
110
QXLive/Tabbar/弹窗/QXGiftCell.m
Normal file
110
QXLive/Tabbar/弹窗/QXGiftCell.m
Normal file
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// QXGiftCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import "QXGiftCell.h"
|
||||
|
||||
@implementation QXGiftCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageWithColor:RGB16(0xEFF2F8)] forState:(UIControlStateNormal)];
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageNamed:@"mine_dress_bg"] forState:(UIControlStateSelected)];
|
||||
}
|
||||
|
||||
-(void)setCellType:(QXGiftCellType)cellType{
|
||||
_cellType = cellType;
|
||||
switch (cellType) {
|
||||
case QXGiftCellTypeNiceGift:{
|
||||
self.numberWidthConstraint.constant = 23;
|
||||
self.numberHeightConstraint.constant = 9;
|
||||
self.cornHeight.constant = 10;
|
||||
self.nameLabelHeight.constant = 10;
|
||||
self.giftNameLabel.font = [UIFont systemFontOfSize:8];
|
||||
self.cornBtn.titleLabel.font = [UIFont systemFontOfSize:8];
|
||||
self.userHeaderView.hidden = YES;
|
||||
}
|
||||
break;
|
||||
case QXGiftCellTypeBackpack:{
|
||||
self.numberWidthConstraint.constant = 35;
|
||||
self.numberHeightConstraint.constant = 13;
|
||||
self.cornHeight.constant = 18;
|
||||
self.nameLabelHeight.constant = 18;
|
||||
self.giftNameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.numberLabel.font = [UIFont systemFontOfSize:10];
|
||||
self.cornBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.selecteBtn.selected = YES;
|
||||
[self.cornBtn setImage:[UIImage imageNamed:@"mine_live_gift_corn"] forState:(UIControlStateNormal)];
|
||||
self.userHeaderView.hidden = YES;
|
||||
}
|
||||
break;
|
||||
case QXGiftCellTypeLive:{
|
||||
self.numberWidthConstraint.constant = 35;
|
||||
self.numberHeightConstraint.constant = 13;
|
||||
self.cornHeight.constant = 18;
|
||||
self.nameLabelHeight.constant = 18;
|
||||
self.giftNameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.cornBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.cornBtn setImage:[UIImage imageNamed:@"mine_live_gift_corn"] forState:(UIControlStateNormal)];
|
||||
self.userHeaderView.hidden = YES;
|
||||
self.numberBgView.hidden = YES;
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageWithColor:RGB16A(0xE9E9E9, 0.2)] forState:(UIControlStateNormal)];
|
||||
[self.selecteBtn setBackgroundImage:[UIImage imageNamed:@"room_sound_sel"] forState:(UIControlStateSelected)];
|
||||
}
|
||||
break;
|
||||
|
||||
case QXGiftCellTypeGiftWall:{
|
||||
self.numberWidthConstraint.constant = 35;
|
||||
self.numberHeightConstraint.constant = 13;
|
||||
self.cornHeight.constant = 18;
|
||||
self.nameLabelHeight.constant = 18;
|
||||
self.giftNameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.cornBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.cornBtn setImage:[UIImage imageNamed:@"mine_live_gift_corn"] forState:(UIControlStateNormal)];
|
||||
self.userHeaderView.hidden = NO;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
-(void)setRoomGiftModel:(QXGiftModel *)roomGiftModel{
|
||||
_roomGiftModel = roomGiftModel;
|
||||
self.giftNameLabel.text = roomGiftModel.gift_name;
|
||||
[self.gitfImageView sd_setImageWithURL:[NSURL URLWithString:roomGiftModel.base_image]];
|
||||
[self.cornBtn setTitle:[NSString stringWithFormat:@" %@",roomGiftModel.gift_price] forState:(UIControlStateNormal)];
|
||||
if (roomGiftModel.num.intValue > 0) {
|
||||
self.numberBgView.hidden = NO;
|
||||
self.numberLabel.text = [NSString stringWithFormat:@"x%@",roomGiftModel.num];
|
||||
}else{
|
||||
self.numberBgView.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setGiftWall:(QXUserGiftWallModel *)giftWall{
|
||||
_giftWall = giftWall;
|
||||
self.giftNameLabel.text = giftWall.gift_name;
|
||||
[self.gitfImageView sd_setImageWithURL:[NSURL URLWithString:giftWall.base_image]];
|
||||
self.numberLabel.text = [NSString stringWithFormat:@"x%@",giftWall.total_count];
|
||||
self.grayCoverView.backgroundColor = RGB16A(0xE9E9E9, 0.8);
|
||||
if (giftWall.total_count.longLongValue == 0) {
|
||||
self.numberBgView.hidden = YES;
|
||||
self.grayCoverView.hidden = NO;
|
||||
}else{
|
||||
self.numberBgView.hidden = NO;
|
||||
self.grayCoverView.hidden = YES;
|
||||
}
|
||||
[self.cornBtn setTitle:[NSString stringWithFormat:@" %@",giftWall.gift_price] forState:(UIControlStateNormal)];
|
||||
QXUserHomeModel*user = giftWall.top_users.firstObject;
|
||||
if (user) {
|
||||
self.userHeaderView.hidden = NO;
|
||||
[self.userHeaderView sd_setImageWithURL:[NSURL URLWithString:user.avatar]];
|
||||
}else{
|
||||
self.userHeaderView.hidden = YES;
|
||||
}
|
||||
}
|
||||
@end
|
||||
156
QXLive/Tabbar/弹窗/QXGiftCell.xib
Normal file
156
QXLive/Tabbar/弹窗/QXGiftCell.xib
Normal file
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="QXGiftCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="253" height="303"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="253" height="303"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QMu-c3-HcP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="253" height="303"/>
|
||||
<subviews>
|
||||
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YN0-v8-SAo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="253" height="303"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="anN-iX-rGm">
|
||||
<rect key="frame" x="230" y="0.0" width="23" height="9"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="gift_number_bg" translatesAutoresizingMaskIntoConstraints="NO" id="Yu7-xk-6PI">
|
||||
<rect key="frame" x="0.0" y="0.0" width="23" height="9"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="x99" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NY9-Jo-6BD">
|
||||
<rect key="frame" x="0.0" y="0.0" width="23" height="9"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="7"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="NY9-Jo-6BD" firstAttribute="top" secondItem="anN-iX-rGm" secondAttribute="top" id="EEs-zk-dKx"/>
|
||||
<constraint firstItem="NY9-Jo-6BD" firstAttribute="leading" secondItem="anN-iX-rGm" secondAttribute="leading" id="Ptd-SE-gCD"/>
|
||||
<constraint firstAttribute="bottom" secondItem="NY9-Jo-6BD" secondAttribute="bottom" id="Q6n-eP-v2P"/>
|
||||
<constraint firstAttribute="width" constant="23" id="TKe-Nq-00R"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Yu7-xk-6PI" secondAttribute="bottom" id="U0K-XR-YH3"/>
|
||||
<constraint firstItem="Yu7-xk-6PI" firstAttribute="leading" secondItem="anN-iX-rGm" secondAttribute="leading" id="aW4-7r-fQ0"/>
|
||||
<constraint firstItem="Yu7-xk-6PI" firstAttribute="top" secondItem="anN-iX-rGm" secondAttribute="top" id="iAx-xJ-Oil"/>
|
||||
<constraint firstAttribute="height" constant="9" id="kap-xl-Ydf"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Yu7-xk-6PI" secondAttribute="trailing" id="lmx-7S-0Gr"/>
|
||||
<constraint firstAttribute="trailing" secondItem="NY9-Jo-6BD" secondAttribute="trailing" id="z9T-dt-Qob"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="1oa-XB-z2H">
|
||||
<rect key="frame" x="5" y="7" width="243" height="250"/>
|
||||
</imageView>
|
||||
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="niZ-Xc-95T">
|
||||
<rect key="frame" x="0.0" y="0.0" width="253" height="303"/>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="爱的抱抱" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rHb-Od-M4a">
|
||||
<rect key="frame" x="5" y="257" width="243" height="18"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="yY1-Fd-GTO"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="8"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3d1-U7-04n">
|
||||
<rect key="frame" x="5" y="278" width="243" height="18"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="svX-z8-2v4"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="8"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
|
||||
<state key="normal" title=" 9999" image="gift_corn">
|
||||
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
</button>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="fxQ-G1-4U5">
|
||||
<rect key="frame" x="4" y="4" width="15" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="15" id="1Di-mL-Ufh"/>
|
||||
<constraint firstAttribute="height" constant="15" id="sDK-xi-9FI"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<real key="value" value="7.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="YN0-v8-SAo" secondAttribute="bottom" id="0UV-vT-lSa"/>
|
||||
<constraint firstItem="niZ-Xc-95T" firstAttribute="leading" secondItem="QMu-c3-HcP" secondAttribute="leading" id="4eE-QY-8iw"/>
|
||||
<constraint firstAttribute="trailing" secondItem="niZ-Xc-95T" secondAttribute="trailing" id="88r-oD-p4E"/>
|
||||
<constraint firstItem="3d1-U7-04n" firstAttribute="leading" secondItem="1oa-XB-z2H" secondAttribute="leading" id="8De-gE-33I"/>
|
||||
<constraint firstItem="rHb-Od-M4a" firstAttribute="top" secondItem="1oa-XB-z2H" secondAttribute="bottom" id="8dO-90-EcR"/>
|
||||
<constraint firstItem="fxQ-G1-4U5" firstAttribute="top" secondItem="QMu-c3-HcP" secondAttribute="top" constant="4" id="AaP-Bh-HJO"/>
|
||||
<constraint firstAttribute="bottom" secondItem="niZ-Xc-95T" secondAttribute="bottom" id="Hcq-Ev-Yt1"/>
|
||||
<constraint firstAttribute="trailing" secondItem="1oa-XB-z2H" secondAttribute="trailing" constant="5" id="IeP-It-gIz"/>
|
||||
<constraint firstItem="YN0-v8-SAo" firstAttribute="top" secondItem="QMu-c3-HcP" secondAttribute="top" id="MM9-lD-eb5"/>
|
||||
<constraint firstItem="1oa-XB-z2H" firstAttribute="leading" secondItem="QMu-c3-HcP" secondAttribute="leading" constant="5" id="MYb-BM-fhX"/>
|
||||
<constraint firstItem="anN-iX-rGm" firstAttribute="top" secondItem="QMu-c3-HcP" secondAttribute="top" id="QVB-1T-j7f"/>
|
||||
<constraint firstAttribute="trailing" secondItem="YN0-v8-SAo" secondAttribute="trailing" id="TM5-gQ-Sjd"/>
|
||||
<constraint firstItem="niZ-Xc-95T" firstAttribute="top" secondItem="QMu-c3-HcP" secondAttribute="top" id="Vx1-do-zNx"/>
|
||||
<constraint firstAttribute="trailing" secondItem="anN-iX-rGm" secondAttribute="trailing" id="gMa-Ee-Va2"/>
|
||||
<constraint firstItem="YN0-v8-SAo" firstAttribute="leading" secondItem="QMu-c3-HcP" secondAttribute="leading" id="gwM-TL-16q"/>
|
||||
<constraint firstItem="rHb-Od-M4a" firstAttribute="trailing" secondItem="1oa-XB-z2H" secondAttribute="trailing" id="j58-9C-4jp"/>
|
||||
<constraint firstItem="rHb-Od-M4a" firstAttribute="leading" secondItem="1oa-XB-z2H" secondAttribute="leading" id="lZC-mt-8rI"/>
|
||||
<constraint firstItem="fxQ-G1-4U5" firstAttribute="leading" secondItem="QMu-c3-HcP" secondAttribute="leading" constant="4" id="sEi-oU-MFz"/>
|
||||
<constraint firstItem="3d1-U7-04n" firstAttribute="trailing" secondItem="1oa-XB-z2H" secondAttribute="trailing" id="su7-47-d1q"/>
|
||||
<constraint firstItem="3d1-U7-04n" firstAttribute="top" secondItem="rHb-Od-M4a" secondAttribute="bottom" constant="3" id="tsv-TX-kEv"/>
|
||||
<constraint firstAttribute="bottom" secondItem="3d1-U7-04n" secondAttribute="bottom" constant="7" id="vHo-v2-n7q"/>
|
||||
<constraint firstItem="1oa-XB-z2H" firstAttribute="top" secondItem="anN-iX-rGm" secondAttribute="bottom" constant="-2" id="wzY-ud-btV"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
</view>
|
||||
<viewLayoutGuide key="safeArea" id="SEy-5g-ep8"/>
|
||||
<constraints>
|
||||
<constraint firstItem="QMu-c3-HcP" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="1mN-Um-ETK"/>
|
||||
<constraint firstAttribute="trailing" secondItem="QMu-c3-HcP" secondAttribute="trailing" id="QHz-IM-RT8"/>
|
||||
<constraint firstAttribute="bottom" secondItem="QMu-c3-HcP" secondAttribute="bottom" id="amE-gn-beF"/>
|
||||
<constraint firstItem="QMu-c3-HcP" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="y9f-l6-oun"/>
|
||||
</constraints>
|
||||
<size key="customSize" width="253" height="303"/>
|
||||
<connections>
|
||||
<outlet property="cornBtn" destination="3d1-U7-04n" id="PLQ-JR-U9b"/>
|
||||
<outlet property="cornHeight" destination="svX-z8-2v4" id="ocG-gq-4Wo"/>
|
||||
<outlet property="giftNameLabel" destination="rHb-Od-M4a" id="nik-Bp-Ce4"/>
|
||||
<outlet property="gitfImageView" destination="1oa-XB-z2H" id="1bo-km-q0H"/>
|
||||
<outlet property="grayCoverView" destination="niZ-Xc-95T" id="vbK-Sr-GkT"/>
|
||||
<outlet property="nameLabelHeight" destination="yY1-Fd-GTO" id="ewH-OC-DXC"/>
|
||||
<outlet property="numberBgView" destination="anN-iX-rGm" id="6VQ-ZT-vQ2"/>
|
||||
<outlet property="numberHeightConstraint" destination="kap-xl-Ydf" id="SBZ-42-8wP"/>
|
||||
<outlet property="numberLabel" destination="NY9-Jo-6BD" id="2ua-Kf-Wue"/>
|
||||
<outlet property="numberWidthConstraint" destination="TKe-Nq-00R" id="yDl-AX-pmQ"/>
|
||||
<outlet property="selecteBtn" destination="YN0-v8-SAo" id="xcO-aq-DzN"/>
|
||||
<outlet property="userHeaderView" destination="fxQ-G1-4U5" id="857-MT-DQR"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="293.89312977099235" y="108.80281690140846"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="gift_corn" width="6" height="6"/>
|
||||
<image name="gift_number_bg" width="22.666666030883789" height="8.6666669845581055"/>
|
||||
<image name="user_header_placehoulder" width="40" height="40"/>
|
||||
</resources>
|
||||
</document>
|
||||
20
QXLive/Tabbar/弹窗/QXGiftDriftView.h
Normal file
20
QXLive/Tabbar/弹窗/QXGiftDriftView.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// QXGiftDriftView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXGiftScrollView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXGiftDriftView : UIView
|
||||
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)QXGiftScrollModel *model;
|
||||
-(void)addGiftModel:(QXGiftScrollModel*)model;
|
||||
+(instancetype)shareView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
116
QXLive/Tabbar/弹窗/QXGiftDriftView.m
Normal file
116
QXLive/Tabbar/弹窗/QXGiftDriftView.m
Normal file
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// QXGiftDriftView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import "QXGiftDriftView.h"
|
||||
@interface QXGiftDriftView()
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIImageView *giftImageView;
|
||||
@property (nonatomic,strong)UILabel *countLabel;
|
||||
@property (nonatomic,assign)BOOL isPlaying;
|
||||
@end
|
||||
@implementation QXGiftDriftView
|
||||
+(instancetype)shareView{
|
||||
static QXGiftDriftView *manager = nil;
|
||||
static dispatch_once_t predicate;
|
||||
dispatch_once(&predicate, ^{
|
||||
manager = [[QXGiftDriftView alloc] init];
|
||||
});
|
||||
return manager;
|
||||
}
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(SCREEN_WIDTH, 150, ScaleWidth(316), ScaleWidth(50));
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"pop_gift_bg"]];
|
||||
self.bgImageView.frame = self.bounds;
|
||||
[self addSubview:self.bgImageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.titleLabel.textColor = UIColor.whiteColor;
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self).offset(-ScaleWidth(30));
|
||||
make.height.mas_equalTo(30);
|
||||
make.centerY.equalTo(self).offset(2);
|
||||
}];
|
||||
|
||||
self.giftImageView = [[UIImageView alloc] init];
|
||||
self.giftImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self addSubview:self.giftImageView];
|
||||
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel.mas_right).offset(5);
|
||||
make.height.width.mas_equalTo(20);
|
||||
make.centerY.equalTo(self).offset(2);
|
||||
}];
|
||||
|
||||
self.countLabel = [[UILabel alloc] init];
|
||||
self.countLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.countLabel.textColor = UIColor.whiteColor;
|
||||
[self addSubview:self.countLabel];
|
||||
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.giftImageView.mas_right);
|
||||
make.height.mas_equalTo(30);
|
||||
make.centerY.equalTo(self).offset(2);
|
||||
}];
|
||||
}
|
||||
-(void)addGiftModel:(QXGiftScrollModel *)model{
|
||||
[self.dataArray addObject:model];
|
||||
[self giftAction];
|
||||
}
|
||||
|
||||
|
||||
-(void)giftAction{
|
||||
if (self.isPlaying) {
|
||||
return;
|
||||
}
|
||||
[QXGiftDriftView shareView].isPlaying = YES;
|
||||
[QXGiftDriftView shareView].model = [QXGiftDriftView shareView].dataArray.firstObject;
|
||||
[KEYWINDOW addSubview:[QXGiftDriftView shareView]];
|
||||
[UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
|
||||
[QXGiftDriftView shareView].x = (SCREEN_WIDTH-ScaleWidth(316))/2;
|
||||
} completion:^(BOOL finished) {
|
||||
[UIView animateWithDuration:2 delay:1 options:UIViewAnimationOptionCurveEaseIn animations:^{
|
||||
[QXGiftDriftView shareView].x = -SCREEN_WIDTH;
|
||||
} completion:^(BOOL finished) {
|
||||
[QXGiftDriftView shareView].x = SCREEN_WIDTH;
|
||||
[[QXGiftDriftView shareView] removeFromSuperview];
|
||||
[[QXGiftDriftView shareView].dataArray removeFirstObject];
|
||||
[QXGiftDriftView shareView].isPlaying = NO;
|
||||
if ([QXGiftDriftView shareView].dataArray.count>0) {
|
||||
[[QXGiftDriftView shareView] giftAction];
|
||||
}
|
||||
}];
|
||||
}];
|
||||
}
|
||||
-(void)setModel:(QXGiftScrollModel *)model{
|
||||
_model = model;
|
||||
NSString *str = [NSString stringWithFormat:@"%@送给%@",model.fromUserName,model.toUserName];
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
|
||||
[attr yy_setColor:RGB16(0xFFDE77) range:[str rangeOfString:model.fromUserName]];
|
||||
[attr yy_setColor:RGB16(0xFFDE77) range:[str rangeOfString:model.toUserName]];
|
||||
self.titleLabel.attributedText = attr;
|
||||
|
||||
[self.giftImageView sd_setImageWithURL:[NSURL URLWithString:model.gift_picture]];
|
||||
self.countLabel.text = [NSString stringWithFormat:@"X%@",model.number];
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
@end
|
||||
17
QXLive/Tabbar/弹窗/QXInvitePopView.h
Normal file
17
QXLive/Tabbar/弹窗/QXInvitePopView.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXInvitePopView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXInvitePopView : UIView
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^agreeActionBlock)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
117
QXLive/Tabbar/弹窗/QXInvitePopView.m
Normal file
117
QXLive/Tabbar/弹窗/QXInvitePopView.m
Normal file
@@ -0,0 +1,117 @@
|
||||
//
|
||||
// QXInvitePopView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import "QXInvitePopView.h"
|
||||
#import "QXSeatHeaderView.h"
|
||||
#import "QXTimer.h"
|
||||
|
||||
@interface QXInvitePopView()
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)QXSeatHeaderView *headerView;
|
||||
@property (nonatomic,strong)UILabel *inviteLabel;
|
||||
@property (nonatomic,strong)UIButton *agreeBtn;
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@end
|
||||
@implementation QXInvitePopView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, ScaleWidth(275), ScaleWidth(200+48));
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_invite"]];
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.left.right.equalTo(self);
|
||||
make.height.mas_equalTo(ScaleWidth(200));
|
||||
}];
|
||||
|
||||
self.headerView = [[QXSeatHeaderView alloc] init];
|
||||
[self addSubview:self.headerView];
|
||||
[self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(70, 70));
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self).offset(12);
|
||||
}];
|
||||
|
||||
self.inviteLabel = [[UILabel alloc] init];
|
||||
self.inviteLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.inviteLabel.text = QXText(@"邀请你进房陪她聊天");
|
||||
self.inviteLabel.textColor = RGB16(0x333333);
|
||||
[self addSubview:self.inviteLabel];
|
||||
[self.inviteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self.headerView.mas_bottom).offset(12);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
|
||||
self.agreeBtn = [[UIButton alloc] init];
|
||||
[self.agreeBtn addRoundedCornersWithRadius:21];
|
||||
self.agreeBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.agreeBtn setTitle:QXText(@"接收邀请") forState:(UIControlStateNormal)];
|
||||
[self.agreeBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.agreeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.agreeBtn addTarget:self action:@selector(agreeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.agreeBtn];
|
||||
[self.agreeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgImageView).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(178);
|
||||
make.centerX.equalTo(self.bgImageView);
|
||||
}];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).offset(8);
|
||||
make.height.width.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
__block int timeCount = 10;
|
||||
MJWeakSelf
|
||||
_timer = [QXTimer scheduledTimerWithTimeInterval:1 repeats:YES queue:dispatch_get_main_queue() block:^{
|
||||
timeCount--;
|
||||
if (timeCount<=0) {
|
||||
[weakSelf noAgree];
|
||||
[self->_agreeBtn setTitle:[NSString stringWithFormat:@"%@(0)",QXText(@"接收邀请")] forState:(UIControlStateNormal)];
|
||||
[[QXGlobal shareGlobal] hideViewBlock:^{
|
||||
|
||||
}];
|
||||
}
|
||||
[self->_agreeBtn setTitle:[NSString stringWithFormat:@"%@(%d)",QXText(@"接收邀请"),timeCount] forState:(UIControlStateNormal)];
|
||||
}];
|
||||
}
|
||||
-(void)noAgree{
|
||||
[self->_timer invalidate];
|
||||
}
|
||||
|
||||
-(void)agreeAction{
|
||||
MJWeakSelf
|
||||
[[QXGlobal shareGlobal] hideViewBlock:^{
|
||||
if (weakSelf.agreeActionBlock) {
|
||||
weakSelf.agreeActionBlock();
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)closeAction{
|
||||
[self noAgree];
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
19
QXLive/Tabbar/弹窗/QXNiceGiftPopView.h
Normal file
19
QXLive/Tabbar/弹窗/QXNiceGiftPopView.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXNiceGiftPopView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXNiceGiftPopView : UIView
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^getActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^ruleActionBlock)(void);
|
||||
@property (nonatomic,strong)NSArray *giftArray;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
217
QXLive/Tabbar/弹窗/QXNiceGiftPopView.m
Normal file
217
QXLive/Tabbar/弹窗/QXNiceGiftPopView.m
Normal file
@@ -0,0 +1,217 @@
|
||||
//
|
||||
// QXNiceGiftPopView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/13.
|
||||
//
|
||||
|
||||
#import "QXNiceGiftPopView.h"
|
||||
#import "GKPageControl.h"
|
||||
#import "QXGiftCell.h"
|
||||
|
||||
@interface QXNiceGiftPopView()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIImageView *lightBgImageView;
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UIImageView *timeDownbgView;
|
||||
@property (nonatomic,strong)UILabel *timeDownLabel;
|
||||
@property (nonatomic,strong)UIView *giftBgView;
|
||||
@property (nonatomic,strong)UIButton *ruleBtn;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)GKPageControl *pageControl;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *getBtn;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@end
|
||||
@implementation QXNiceGiftPopView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(582));
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.lightBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_bg"]];
|
||||
[self addSubview:self.lightBgImageView];
|
||||
[self.lightBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_nice_gift"]];
|
||||
[self addSubview:self.bgImageView];
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(275), ScaleWidth(338)));
|
||||
}];
|
||||
|
||||
self.timeDownbgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"gift_time_bg"]];
|
||||
[self addSubview:self.timeDownbgView];
|
||||
[self.timeDownbgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.bgImageView).offset(ScaleWidth(117));
|
||||
make.left.equalTo(self.bgImageView).offset(9);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(179), ScaleWidth(20)));
|
||||
}];
|
||||
|
||||
self.timeDownLabel = [[UILabel alloc] init];
|
||||
self.timeDownLabel.textColor = RGB16(0x666666);
|
||||
self.timeDownLabel.text = QXText(@"剩余时间");
|
||||
self.timeDownLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:self.timeDownLabel];
|
||||
[self.timeDownLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.bottom.equalTo(self.timeDownbgView);
|
||||
make.left.equalTo(self.timeDownbgView).offset(19);
|
||||
make.right.equalTo(self.timeDownbgView).offset(-19);
|
||||
}];
|
||||
|
||||
self.ruleBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 54, 20)];
|
||||
self.ruleBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.ruleBtn addTarget:self action:@selector(ruleAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.ruleBtn setTitle:QXText(@"规则") forState:(UIControlStateNormal)];
|
||||
self.ruleBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.ruleBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.ruleBtn addRoundedCornersWithRadius:10 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerBottomLeft)];
|
||||
[self addSubview:self.ruleBtn];
|
||||
[self.ruleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.equalTo(self.bgImageView);
|
||||
make.centerY.equalTo(self.timeDownbgView);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(54), ScaleWidth(20)));
|
||||
}];
|
||||
|
||||
self.giftBgView = [[UIView alloc] init];
|
||||
// self.giftBgView.backgroundColor = [UIColor whiteColor];
|
||||
[self.giftBgView addRoundedCornersWithRadius:13];
|
||||
[self addSubview:self.giftBgView];
|
||||
[self.giftBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.timeDownbgView.mas_bottom).offset(ScaleWidth(3));
|
||||
make.left.equalTo(self.bgImageView).offset(15);
|
||||
make.right.equalTo(self.bgImageView).offset(-15);
|
||||
make.bottom.equalTo(self.bgImageView).offset(-ScaleWidth(51));
|
||||
}];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake((ScaleWidth(275-15*2-12*2-3*8))/4, ScaleWidth(76));
|
||||
layout.minimumLineSpacing = 8;
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
[self.collectionView registerNib:[UINib nibWithNibName:@"QXGiftCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"QXGiftCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.collectionView.pagingEnabled = YES;
|
||||
[self.giftBgView addSubview:self.collectionView];
|
||||
[self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.top.mas_equalTo(ScaleWidth(16));
|
||||
make.height.mas_equalTo(ScaleWidth(76));
|
||||
make.right.mas_equalTo(-12);
|
||||
}];
|
||||
|
||||
_pageControl = [[GKPageControl alloc] init];
|
||||
_pageControl.style = GKPageControlStyleRectangle;
|
||||
_pageControl.dotWidth = 15;
|
||||
_pageControl.dotHeight = 5;
|
||||
_pageControl.dotMargin = 2;
|
||||
_pageControl.pageIndicatorTintColor = RGB16(0xEBEBEB);
|
||||
_pageControl.currentPageIndicatorTintColor = QXConfig.textColor;
|
||||
[self.giftBgView addSubview:self.pageControl];
|
||||
[self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.collectionView.mas_bottom).offset(9);
|
||||
make.height.mas_equalTo(5);
|
||||
make.right.mas_equalTo(-48);
|
||||
make.left.mas_equalTo(48);
|
||||
}];
|
||||
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
self.messageLabel.text = QXText(@"充值6元即可获得总价值888金币的道具或装扮");
|
||||
self.messageLabel.textColor = QXConfig.textColor;
|
||||
[self.giftBgView addSubview:self.messageLabel];
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.right.mas_equalTo(-12);
|
||||
make.top.equalTo(self.pageControl.mas_bottom).offset(2);
|
||||
make.bottom.equalTo(self.giftBgView).offset(-5);
|
||||
}];
|
||||
|
||||
|
||||
self.getBtn = [[UIButton alloc] init];
|
||||
[self.getBtn addRoundedCornersWithRadius:21];
|
||||
self.getBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.getBtn setTitle:QXText(@"立即领取") forState:(UIControlStateNormal)];
|
||||
[self.getBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.getBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.getBtn addTarget:self action:@selector(getAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.getBtn];
|
||||
[self.getBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgImageView).offset(-ScaleWidth(16));
|
||||
make.height.mas_equalTo(42);
|
||||
make.right.equalTo(self.bgImageView).offset(-48);
|
||||
make.left.equalTo(self.bgImageView).offset(48);
|
||||
}];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).offset(8);
|
||||
make.height.width.mas_equalTo(30);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
|
||||
if ([scrollView isKindOfClass:[UICollectionView class]]) {
|
||||
long offsetX = (long)scrollView.contentOffset.x;
|
||||
int width = ScaleWidth(275-15*2-12*2-3*8);
|
||||
int remainder = offsetX % width;
|
||||
NSInteger index;
|
||||
if (remainder>(width)/2) {
|
||||
index = offsetX/width+1;
|
||||
}else{
|
||||
index = offsetX/width;
|
||||
}
|
||||
self.pageControl.currentPage = index;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void)setGiftArray:(NSArray *)giftArray{
|
||||
_giftArray = giftArray;
|
||||
self.pageControl.numberOfPages = giftArray.count/4+1;
|
||||
self.pageControl.currentPage = 0;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.giftArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXGiftCell" forIndexPath:indexPath];
|
||||
cell.cellType = QXGiftCellTypeNiceGift;
|
||||
return cell;
|
||||
}
|
||||
|
||||
// 规则
|
||||
-(void)ruleAction{
|
||||
if (self.ruleActionBlock) {
|
||||
self.ruleActionBlock();
|
||||
}
|
||||
}
|
||||
// 立即领取
|
||||
-(void)getAction{
|
||||
if (self.getActionBlock) {
|
||||
self.getActionBlock();
|
||||
}
|
||||
}
|
||||
-(void)closeAction{
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
17
QXLive/Tabbar/弹窗/QXRealNamePopView.h
Normal file
17
QXLive/Tabbar/弹窗/QXRealNamePopView.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXRealNamePopView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/14.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRealNamePopView : UIView
|
||||
@property (nonatomic,copy)void(^closeActionBlock)(void);
|
||||
@property (nonatomic,copy)void(^authActionBlock)(void);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
93
QXLive/Tabbar/弹窗/QXRealNamePopView.m
Normal file
93
QXLive/Tabbar/弹窗/QXRealNamePopView.m
Normal file
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// QXRealNamePopView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/14.
|
||||
//
|
||||
|
||||
#import "QXRealNamePopView.h"
|
||||
@interface QXRealNamePopView()
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
@property (nonatomic,strong)UIButton *goBtn;
|
||||
@property (nonatomic,strong)UIButton *closeBtn;
|
||||
@end
|
||||
|
||||
@implementation QXRealNamePopView
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, ScaleWidth(275), ScaleWidth(300+48));
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubViews{
|
||||
self.bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"a_pop_realname"]];
|
||||
[self addSubview:self.bgImageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.text = QXText(@"实名认证");
|
||||
self.titleLabel.textColor = RGB16(0x000000);
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self.bgImageView).offset(ScaleWidth(150));
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
|
||||
self.goBtn = [[UIButton alloc] init];
|
||||
[self.goBtn addRoundedCornersWithRadius:21];
|
||||
self.goBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.goBtn setTitle:QXText(@"立即认证") forState:(UIControlStateNormal)];
|
||||
[self.goBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
self.goBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.goBtn addTarget:self action:@selector(gotoAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.goBtn];
|
||||
[self.goBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self.bgImageView).offset(-12);
|
||||
make.height.mas_equalTo(42);
|
||||
make.width.mas_equalTo(178);
|
||||
make.centerX.equalTo(self.bgImageView);
|
||||
}];
|
||||
|
||||
|
||||
self.messageLabel = [[UILabel alloc] init];
|
||||
self.messageLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.messageLabel.text = QXText(@"根据国家相关要求,开启直播需要实名认证,是否进行认证?");
|
||||
self.messageLabel.textColor = RGB16(0x000000);
|
||||
self.messageLabel.numberOfLines = 0;
|
||||
[self addSubview:self.messageLabel];
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(13);
|
||||
make.right.mas_equalTo(-13);
|
||||
make.bottom.equalTo(self.goBtn.mas_top).offset(-10);
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(8);
|
||||
}];
|
||||
|
||||
self.closeBtn = [[UIButton alloc] init];
|
||||
[self.closeBtn setBackgroundImage:[UIImage imageNamed:@"home_white_close"] forState:(UIControlStateNormal)];
|
||||
[self.closeBtn addTarget:self action:@selector(closeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.closeBtn];
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self.bgImageView.mas_bottom).offset(8);
|
||||
make.height.width.mas_equalTo(30);
|
||||
}];
|
||||
}
|
||||
-(void)gotoAction{
|
||||
if (self.authActionBlock) {
|
||||
self.authActionBlock();
|
||||
}
|
||||
}
|
||||
-(void)closeAction{
|
||||
if (self.closeActionBlock) {
|
||||
self.closeActionBlock();
|
||||
}
|
||||
}
|
||||
@end
|
||||
54
QXLive/Tabbar/弹窗/QXShareView.h
Normal file
54
QXLive/Tabbar/弹窗/QXShareView.h
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// QXShareView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXDynamicModel.h"
|
||||
typedef NS_ENUM(NSInteger) {
|
||||
QXShareViewTypeFind,
|
||||
QXShareViewTypeSharePhoto
|
||||
}QXShareViewType;
|
||||
@class QXShareViewModel;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol QXShareViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
-(void)didClickShareModel:(QXShareViewModel*)model;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface QXShareView : UIView
|
||||
@property (nonatomic,assign)QXShareViewType shareType;
|
||||
@property (nonatomic,weak)id<QXShareViewDelegate>delegate;
|
||||
/// 分享动态时传参
|
||||
@property (nonatomic,strong)QXDynamicModel *dynamicModel;
|
||||
/// 分享图片时传参
|
||||
@property (nonatomic,strong)NSData *imageData;
|
||||
-(void)showInView:(UIView*)view;
|
||||
-(void)hideView;
|
||||
|
||||
@end
|
||||
|
||||
@interface QXShareViewContentCell : UICollectionViewCell<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSMutableArray* dataArray;
|
||||
@property (nonatomic,weak)id<QXShareViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXShareViewCell : UICollectionViewCell
|
||||
@property (nonatomic,strong)UIImageView *imageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)QXShareViewModel *model;
|
||||
@end
|
||||
|
||||
@interface QXShareViewModel:NSObject
|
||||
@property (nonatomic,strong)NSString *icon;
|
||||
@property (nonatomic,strong)NSString *name;
|
||||
@property (nonatomic,strong)NSString *Id;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
430
QXLive/Tabbar/弹窗/QXShareView.m
Normal file
430
QXLive/Tabbar/弹窗/QXShareView.m
Normal file
@@ -0,0 +1,430 @@
|
||||
//
|
||||
// QXShareView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/21.
|
||||
//
|
||||
|
||||
#import "QXShareView.h"
|
||||
#import <WXApi.h>
|
||||
#import <TencentOpenAPI/TencentOpenApiUmbrellaHeader.h>
|
||||
#import "QXDynamicNetwork.h"
|
||||
|
||||
@interface QXShareView()<UICollectionViewDelegate,UICollectionViewDataSource,UIGestureRecognizerDelegate,QXShareViewDelegate>
|
||||
@property (nonatomic,strong)UIView *bgView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
@property (nonatomic,strong)NSMutableArray *friendArray;
|
||||
@property (nonatomic,strong)NSMutableArray *eventArray;
|
||||
@end
|
||||
@implementation QXShareView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideView)];
|
||||
tap.delegate = self;
|
||||
[self addGestureRecognizer:tap];
|
||||
self.bgView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 200)];
|
||||
self.bgView.backgroundColor = [UIColor whiteColor];
|
||||
[self addSubview:self.bgView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 16, SCREEN_WIDTH-32, 27)];
|
||||
self.titleLabel.textColor = QXConfig.textColor;
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
|
||||
self.titleLabel.text = QXText(@"分享至");
|
||||
[self.bgView addSubview:self.titleLabel];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake(SCREEN_WIDTH, 71);
|
||||
layout.minimumLineSpacing = 0;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 0, 20, 0);
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, self.titleLabel.bottom+12, self.bgView.width, self.bgView.height-self.titleLabel.bottom-12-kSafeAreaBottom) collectionViewLayout:layout];
|
||||
[self.collectionView registerClass:[QXShareViewContentCell class] forCellWithReuseIdentifier:@"QXShareViewContentCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
[self.bgView addSubview:self.collectionView];
|
||||
}
|
||||
-(void)setShareType:(QXShareViewType)shareType{
|
||||
_shareType = shareType;
|
||||
if (_shareType == QXShareViewTypeFind) {
|
||||
self.bgView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(347));
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
self.collectionView.frame = CGRectMake(0, self.titleLabel.bottom+12, self.bgView.width, self.bgView.height-self.titleLabel.bottom-12-kSafeAreaBottom);
|
||||
}else{
|
||||
self.bgView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, ScaleWidth(200));
|
||||
[self.bgView addRoundedCornersWithRadius:16 byRoundingCorners:(UIRectCornerTopLeft|UIRectCornerTopRight)];
|
||||
self.collectionView.frame = CGRectMake(0, self.titleLabel.bottom+12, self.bgView.width, self.bgView.height-self.titleLabel.bottom-12-kSafeAreaBottom);
|
||||
}
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
|
||||
return touch.view == self;
|
||||
}
|
||||
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
|
||||
if (self.shareType == QXShareViewTypeFind) {
|
||||
return 3;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return 1;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXShareViewContentCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXShareViewContentCell" forIndexPath:indexPath];
|
||||
cell.delegate = self;
|
||||
if (self.shareType == QXShareViewTypeFind) {
|
||||
if (indexPath.section == 0) {
|
||||
cell.dataArray = self.friendArray;
|
||||
}else if (indexPath.section == 1){
|
||||
cell.dataArray = self.dataArray;
|
||||
}else{
|
||||
cell.dataArray = [NSMutableArray arrayWithArray:self.eventArray];
|
||||
}
|
||||
}else{
|
||||
cell.dataArray = self.dataArray;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
-(void)didClickShareModel:(QXShareViewModel *)model{
|
||||
MJWeakSelf
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickShareModel:)]) {
|
||||
[weakSelf.delegate didClickShareModel:model];
|
||||
}
|
||||
[self shareWithPlatform:model];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void)shareWithPlatform:(QXShareViewModel*)model{
|
||||
// [WXApi startLogByLevel:(WXLogLevelDetail) logBlock:^(NSString * _Nonnull log) {
|
||||
// QXLOG(@"wx--------------%@",log);
|
||||
// }];
|
||||
// [WXApi checkUniversalLinkReady:^(WXULCheckStep step, WXCheckULStepResult * _Nonnull result) {
|
||||
// QXLOG(@"步骤wx--------------%ld-----------%@",step,result);
|
||||
// }];
|
||||
// SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
// req.bText = YES;
|
||||
// req.text = @"分享的内容";
|
||||
// req.scene = WXSceneSession;
|
||||
// [WXApi sendReq:req completion:^(BOOL success) {
|
||||
//
|
||||
// }];
|
||||
//
|
||||
// return;
|
||||
if ([model.name isEqualToString:QXText(@"微信好友")]) {
|
||||
|
||||
if (self.dynamicModel != nil) /*分享动态*/{
|
||||
[self shareDynamicWithWechat:YES];
|
||||
}else if (self.imageData != nil){
|
||||
WXImageObject *imageObject = [WXImageObject object];
|
||||
imageObject.imageData = self.imageData;
|
||||
|
||||
WXMediaMessage *message = [WXMediaMessage message];
|
||||
// message.thumbData = nil;
|
||||
message.mediaObject = imageObject;
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = WXSceneSession;
|
||||
[WXApi sendReq:req completion:^(BOOL success) {
|
||||
|
||||
}];
|
||||
}
|
||||
}else if ([model.name isEqualToString:QXText(@"朋友圈")]){
|
||||
if (self.dynamicModel != nil) /*分享朋友圈*/{
|
||||
[self shareDynamicWithWechat:NO];
|
||||
}else if (self.imageData != nil){
|
||||
WXImageObject *imageObject = [WXImageObject object];
|
||||
imageObject.imageData = self.imageData;
|
||||
|
||||
WXMediaMessage *message = [WXMediaMessage message];
|
||||
message.thumbData = self.imageData;
|
||||
message.mediaObject = imageObject;
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = WXSceneTimeline;
|
||||
[WXApi sendReq:req completion:^(BOOL success) {
|
||||
|
||||
}];
|
||||
}
|
||||
}else if ([model.name isEqualToString:QXText(@"QQ")]){
|
||||
if (self.dynamicModel != nil) /*分享动态*/{
|
||||
[self shareDynamicWithQQ:YES];
|
||||
}
|
||||
}else if ([model.name isEqualToString:QXText(@"QQ空间")]){
|
||||
if (self.dynamicModel != nil) /*分享朋友圈*/{
|
||||
[self shareDynamicWithQQ:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)shareDynamicWithWechat:(BOOL)isSession{
|
||||
__block WXWebpageObject *webpageObject = [WXWebpageObject object];
|
||||
__block WXMediaMessage *message = [WXMediaMessage message];
|
||||
webpageObject.webpageUrl = self.dynamicModel.share_url?self.dynamicModel.share_url:@"https://www.baidu.com";
|
||||
if (self.dynamicModel.content.length > 20) {
|
||||
message.description = [self.dynamicModel.content substringToIndex:20];
|
||||
}else{
|
||||
message.description = self.dynamicModel.content;
|
||||
}
|
||||
[message setThumbImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
message.mediaObject = webpageObject;
|
||||
SendMessageToWXReq *req = [[SendMessageToWXReq alloc] init];
|
||||
req.bText = NO;
|
||||
req.message = message;
|
||||
req.scene = isSession?WXSceneSession:WXSceneTimeline;
|
||||
[WXApi sendReq:req completion:^(BOOL success) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)shareDynamicWithQQ:(BOOL)isSession{
|
||||
|
||||
if (self.dynamicModel.images.length == 0) {
|
||||
NSString *content = @"";
|
||||
if (self.dynamicModel.content.length > 20) {
|
||||
content = [self.dynamicModel.content substringToIndex:20];
|
||||
}else{
|
||||
content = self.dynamicModel.content;
|
||||
}
|
||||
QQApiNewsObject *newsObj = [QQApiNewsObject objectWithURL :[NSURL URLWithString:self.dynamicModel.share_url]
|
||||
title: @""
|
||||
description :content
|
||||
previewImageURL:[NSURL URLWithString:self.dynamicModel.avatar]];
|
||||
SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
|
||||
//将内容分享到qq
|
||||
if (isSession) {
|
||||
QQApiSendResultCode sent = [QQApiInterface sendReq:req];
|
||||
}else{
|
||||
//将内容分享到qzone
|
||||
QQApiSendResultCode sent = [QQApiInterface SendReqToQZone:req];
|
||||
}
|
||||
|
||||
}else{
|
||||
NSArray *images = [self.dynamicModel.images componentsSeparatedByString:@","];
|
||||
NSString* img = images.firstObject;
|
||||
NSString *content = @"";
|
||||
if (self.dynamicModel.content.length > 20) {
|
||||
content = [self.dynamicModel.content substringToIndex:20];
|
||||
}else{
|
||||
content = self.dynamicModel.content;
|
||||
}
|
||||
QQApiNewsObject *newsObj = [QQApiNewsObject objectWithURL :[NSURL URLWithString:self.dynamicModel.share_url]
|
||||
title: @""
|
||||
description :content
|
||||
previewImageURL:[NSURL URLWithString:img]];
|
||||
SendMessageToQQReq *req = [SendMessageToQQReq reqWithContent:newsObj];
|
||||
//将内容分享到qq
|
||||
if (isSession) {
|
||||
QQApiSendResultCode sent = [QQApiInterface sendReq:req];
|
||||
}else{
|
||||
//将内容分享到qzone
|
||||
QQApiSendResultCode sent = [QQApiInterface SendReqToQZone:req];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-(void)setImageData:(NSData *)imageData{
|
||||
_imageData = imageData;
|
||||
}
|
||||
|
||||
-(void)setDynamicModel:(QXDynamicModel *)dynamicModel{
|
||||
_dynamicModel = dynamicModel;
|
||||
if (![dynamicModel.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
||||
[self.eventArray removeLastObject];
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXDynamicNetwork mutualRelationshipWithPage:0 successBlock:^(NSArray<QXDynamicLikeModel *> * _Nonnull hotos) {
|
||||
for (QXDynamicLikeModel*md in hotos) {
|
||||
QXShareViewModel *model = [[QXShareViewModel alloc] init];
|
||||
model.icon = md.avatar;
|
||||
model.Id = md.user_id;
|
||||
model.name = md.nickname;
|
||||
[weakSelf.friendArray addObject:model];
|
||||
}
|
||||
[weakSelf.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
[_dataArray addObjectsFromArray:QXConfig.sharePlatforms];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
-(NSMutableArray *)friendArray{
|
||||
if (!_friendArray) {
|
||||
_friendArray = [NSMutableArray array];
|
||||
// QXShareViewModel *model1 = [[QXShareViewModel alloc] init];
|
||||
// model1.icon = @"dynamic_copy_link";
|
||||
// model1.name = QXText(@"复制链接");
|
||||
// model1.Id = @"0";
|
||||
//
|
||||
// QXShareViewModel *model2 = [[QXShareViewModel alloc] init];
|
||||
// model2.icon = @"dynamic_copy_link";
|
||||
// model2.name = QXText(@"举报");
|
||||
// model2.Id = @"1";
|
||||
//
|
||||
// QXShareViewModel *model3 = [[QXShareViewModel alloc] init];
|
||||
// model3.icon = @"dynamic_copy_link";
|
||||
// model3.name = QXText(@"删除");
|
||||
// model3.Id = @"2";
|
||||
// [_friendArray addObjectsFromArray:@[model1,model2,model3,model3,model3,model3,model3,model3]];
|
||||
}
|
||||
return _friendArray;
|
||||
}
|
||||
-(NSMutableArray *)eventArray{
|
||||
if (!_eventArray) {
|
||||
QXShareViewModel *model1 = [[QXShareViewModel alloc] init];
|
||||
model1.icon = @"dynamic_copy_link";
|
||||
model1.name = QXText(@"复制链接");
|
||||
model1.Id = @"0";
|
||||
|
||||
QXShareViewModel *model2 = [[QXShareViewModel alloc] init];
|
||||
model2.icon = @"dynamic_report";
|
||||
model2.name = QXText(@"举报");
|
||||
model2.Id = @"1";
|
||||
|
||||
QXShareViewModel *model3 = [[QXShareViewModel alloc] init];
|
||||
model3.icon = @"dynamic_delete";
|
||||
model3.name = QXText(@"删除");
|
||||
model3.Id = @"2";
|
||||
_eventArray = [NSMutableArray arrayWithArray:@[model1,model2,model3]];
|
||||
}
|
||||
return _eventArray;
|
||||
}
|
||||
-(void)showInView:(UIView *)view{
|
||||
[view addSubview:self];
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT-self.bgView.height;
|
||||
}];
|
||||
}
|
||||
-(void)hideView{
|
||||
[UIView animateWithDuration:0.3 animations:^{
|
||||
self.bgView.y = SCREEN_HEIGHT;
|
||||
} completion:^(BOOL finished) {
|
||||
[self removeFromSuperview];
|
||||
}];
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXShareViewContentCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = CGSizeMake((SCREEN_WIDTH-16*4-16)/5, 71);
|
||||
layout.minimumLineSpacing = 16;
|
||||
layout.minimumInteritemSpacing = 16;
|
||||
layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height) collectionViewLayout:layout];
|
||||
[self.collectionView registerClass:[QXShareViewCell class] forCellWithReuseIdentifier:@"QXShareViewCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
[self.contentView addSubview:self.collectionView];
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXShareViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXShareViewCell" forIndexPath:indexPath];
|
||||
QXShareViewModel *model = self.dataArray[indexPath.row];
|
||||
cell.model = model;
|
||||
return cell;
|
||||
}
|
||||
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXShareViewModel *model = self.dataArray[indexPath.row];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickShareModel:)]) {
|
||||
[self.delegate didClickShareModel:model];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)setDataArray:(NSMutableArray *)dataArray{
|
||||
_dataArray = dataArray;
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation QXShareViewCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, 45)];
|
||||
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self.contentView addSubview:self.imageView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.imageView.bottom+8, self.width, 18)];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.titleLabel.textColor = QXConfig.textColor;
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
}
|
||||
|
||||
-(void)setModel:(QXShareViewModel *)model{
|
||||
_model = model;
|
||||
if ([model.icon hasPrefix:@"https"] || [model.icon hasPrefix:@"http"]) {
|
||||
[self.imageView sd_setImageWithURL:[NSURL URLWithString:model.icon]];
|
||||
}else{
|
||||
self.imageView.image = [UIImage imageNamed:model.icon];
|
||||
}
|
||||
self.titleLabel.text = model.name;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXShareViewModel
|
||||
|
||||
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user