礼物面板修改
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// XPGiftHeadTypeView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/9/29.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class XPGiftHeadTypeView;
|
||||
@protocol XPGiftHeadTypeViewDelegate <NSObject>
|
||||
|
||||
///点击了贵族
|
||||
- (void)xPGiftHeadTypeViewDidClickNoble:(XPGiftHeadTypeView *)view;
|
||||
///点击了首充
|
||||
- (void)xPGiftHeadTypeViewDidClickFirstRecharge:(XPGiftHeadTypeView *)view;
|
||||
///点击了礼物
|
||||
- (void)xPGiftHeadTypeViewDidClickGift:(XPGiftHeadTypeView *)view;
|
||||
///点击了互动
|
||||
- (void)xPGiftHeadTypeViewDidClickInteraction:(XPGiftHeadTypeView *)view;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPGiftHeadTypeView : UIView
|
||||
|
||||
///是否展示首充
|
||||
@property (nonatomic,assign) BOOL isShowFirstRecharge;
|
||||
|
||||
@property (nonatomic, weak) id<XPGiftHeadTypeViewDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
169
xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftHeadTypeView.m
Normal file
169
xplan-ios/Main/ModuleKit/SendGiftView/View/XPGiftHeadTypeView.m
Normal file
@@ -0,0 +1,169 @@
|
||||
//
|
||||
// XPGiftHeadTypeView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/9/29.
|
||||
//
|
||||
|
||||
#import "XPGiftHeadTypeView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||||
///
|
||||
#import "ThemeColor.h"
|
||||
|
||||
@interface XPGiftHeadTypeView()<SDCycleScrollViewDelegate>
|
||||
|
||||
///礼物
|
||||
@property (nonatomic, strong) UIButton *giftButton;
|
||||
///互动
|
||||
@property (nonatomic, strong) UIButton *interactButton;
|
||||
///轮播图
|
||||
@property (nonatomic,strong) SDCycleScrollView *cycleScrollView;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *titleArray;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPGiftHeadTypeView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.giftButton];
|
||||
[self addSubview:self.interactButton];
|
||||
[self addSubview:self.cycleScrollView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
[self.giftButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.width.mas_equalTo(50);
|
||||
}];
|
||||
|
||||
[self.interactButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.left.mas_equalTo(self.giftButton.mas_right).mas_offset(8);
|
||||
make.width.mas_equalTo(50);
|
||||
}];
|
||||
[self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-16);
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.width.mas_equalTo(60);
|
||||
make.height.mas_equalTo(30);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - SDCycleScrollViewDelegate
|
||||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
|
||||
if (self.titleArray.count > index) {
|
||||
NSString *str = self.titleArray[index];
|
||||
if([str isEqualToString:@"首充有礼"]) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftHeadTypeViewDidClickFirstRecharge:)]) {
|
||||
[self.delegate xPGiftHeadTypeViewDidClickFirstRecharge:self];
|
||||
}
|
||||
} else {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftHeadTypeViewDidClickNoble:)]) {
|
||||
[self.delegate xPGiftHeadTypeViewDidClickNoble:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Response
|
||||
- (void)giftButtonAction:(UIButton *)sender {
|
||||
if (!sender.isSelected) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftHeadTypeViewDidClickGift:)]) {
|
||||
[self.delegate xPGiftHeadTypeViewDidClickGift:self];
|
||||
}
|
||||
}
|
||||
sender.selected = YES;
|
||||
self.interactButton.selected = NO;
|
||||
}
|
||||
|
||||
- (void)interactButtonAction:(UIButton *)sender {
|
||||
if (!sender.isSelected) {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPGiftHeadTypeViewDidClickInteraction:)]) {
|
||||
[self.delegate xPGiftHeadTypeViewDidClickInteraction:self];
|
||||
}
|
||||
}
|
||||
sender.selected = YES;
|
||||
self.giftButton.selected = NO;
|
||||
}
|
||||
|
||||
#pragma mark - setter
|
||||
- (void)setIsShowFirstRecharge:(BOOL)isShowFirstRecharge {
|
||||
if (isShowFirstRecharge) {
|
||||
self.titleArray = [NSMutableArray arrayWithObjects:@"首充有礼", @"贵族特权", nil];
|
||||
self.cycleScrollView.imageURLStringsGroup = @[@"gift_first_recharge_bg", @"room_gift_noble_entrance"];
|
||||
} else {
|
||||
self.titleArray = [NSMutableArray arrayWithObjects:@"贵族特权", nil];
|
||||
self.cycleScrollView.imageURLStringsGroup = @[@"room_gift_noble_entrance"];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - getter
|
||||
- (UIButton *)giftButton {
|
||||
if (!_giftButton) {
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.titleLabel.font = [UIFont systemFontOfSize:13];
|
||||
[button addTarget:self action:@selector(giftButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[button setTitle:@"礼物" forState:UIControlStateNormal];
|
||||
[button setTitleColor:[ThemeColor textThirdColor] forState:UIControlStateNormal];
|
||||
[button setTitleColor:[ThemeColor appMainColor] forState:UIControlStateSelected];
|
||||
button.selected = YES;
|
||||
_giftButton = button;
|
||||
}
|
||||
return _giftButton;
|
||||
}
|
||||
|
||||
- (UIButton *)interactButton {
|
||||
if (!_interactButton) {
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.titleLabel.font = [UIFont systemFontOfSize:13];
|
||||
[button addTarget:self action:@selector(interactButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[button setTitle:@"互动" forState:UIControlStateNormal];
|
||||
[button setTitleColor:[ThemeColor textThirdColor] forState:UIControlStateNormal];
|
||||
[button setTitleColor:[ThemeColor appMainColor] forState:UIControlStateSelected];
|
||||
_interactButton = button;
|
||||
}
|
||||
return _interactButton;
|
||||
}
|
||||
|
||||
- (SDCycleScrollView *)cycleScrollView {
|
||||
if (!_cycleScrollView) {
|
||||
_cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero delegate:self placeholderImage:nil];
|
||||
_cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
|
||||
_cycleScrollView.currentPageDotColor = [UIColor whiteColor];
|
||||
_cycleScrollView.pageDotColor = [UIColor colorWithWhite:1 alpha:0.15];
|
||||
_cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"room_activity_banner_select"];
|
||||
_cycleScrollView.pageDotImage = [UIImage imageNamed:@"room_activity_banner_normal"];
|
||||
_cycleScrollView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.00];
|
||||
_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
|
||||
_cycleScrollView.pageControlBottomOffset = -10;
|
||||
_cycleScrollView.autoScrollTimeInterval = 5;
|
||||
}
|
||||
return _cycleScrollView;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)titleArray {
|
||||
if (!_titleArray) {
|
||||
_titleArray = [NSMutableArray array];
|
||||
}
|
||||
return _titleArray;
|
||||
}
|
||||
|
||||
@end
|
@@ -32,6 +32,7 @@
|
||||
#import "XPGiftBarView.h"
|
||||
#import "XPRoomHalfWebView.h"
|
||||
#import "XPGraffitiGiftView.h"
|
||||
#import "XPGiftHeadTypeView.h"
|
||||
///P
|
||||
#import "XPGiftProtocol.h"
|
||||
///VC
|
||||
@@ -40,13 +41,15 @@
|
||||
#import "XPFirstRechargeViewController.h"
|
||||
#import "XPNobleCenterViewController.h"
|
||||
|
||||
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate, XPGraffitiGiftViewDelegate, XPGiftUsersViewDelegate>
|
||||
@interface XPSendGiftView ()< XPGiftBarViewDelegate, XPGiftProtocol, XPGiftInfoViewDelegate, XPGraffitiGiftViewDelegate, XPGiftUsersViewDelegate, XPGiftHeadTypeViewDelegate>
|
||||
///顶部的区域
|
||||
@property (nonatomic,strong) UIView * topView;
|
||||
///内容区域
|
||||
@property (nonatomic,strong) UIView *contentView;
|
||||
///
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///礼物类型(普通/互动)
|
||||
@property (nonatomic, strong) XPGiftHeadTypeView *headTypeView;
|
||||
///送礼物的人
|
||||
@property (nonatomic,strong) XPGiftUsersView *userView;
|
||||
///送的什么礼物
|
||||
@@ -100,6 +103,7 @@
|
||||
[self.view addSubview:self.contentView];
|
||||
[self.contentView addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.graffitiView];
|
||||
[self.stackView addArrangedSubview:self.headTypeView];
|
||||
[self.stackView addArrangedSubview:self.userView];
|
||||
[self.stackView addArrangedSubview:self.giftInfoView];
|
||||
[self.stackView addArrangedSubview:self.giftBarView];
|
||||
@@ -394,6 +398,29 @@
|
||||
[self.delegate.getCurrentNav presentViewController:firstRechargeVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - XPGiftHeadTypeViewDelegate
|
||||
///点击了贵族
|
||||
- (void)xPGiftHeadTypeViewDidClickNoble:(XPGiftHeadTypeView *)view {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventvipEntranceGiftClick];
|
||||
XPNobleCenterViewController * nobleVC = [[XPNobleCenterViewController alloc] initWithRoomUid:self.delegate.getRoomInfo.uid];
|
||||
[self.delegate.getCurrentNav pushViewController:nobleVC animated:YES];
|
||||
}
|
||||
///点击了首充
|
||||
- (void)xPGiftHeadTypeViewDidClickFirstRecharge:(XPGiftHeadTypeView *)view {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
XPFirstRechargeViewController * firstRechargeVC = [[XPFirstRechargeViewController alloc] initWithNavigation:self.delegate.getCurrentNav];
|
||||
[self.delegate.getCurrentNav presentViewController:firstRechargeVC animated:YES completion:nil];
|
||||
}
|
||||
///点击了礼物
|
||||
- (void)xPGiftHeadTypeViewDidClickGift:(XPGiftHeadTypeView *)view {
|
||||
|
||||
}
|
||||
///点击了互动
|
||||
- (void)xPGiftHeadTypeViewDidClickInteraction:(XPGiftHeadTypeView *)view {
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - XPGiftInfoViewDelegate
|
||||
- (void)xPGiftInfoView:(XPGiftInfoView *)view didClickPlayRule:(NSString *)ruleUrl {
|
||||
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
||||
@@ -468,6 +495,7 @@
|
||||
|
||||
#pragma mark - XPGiftProtocol
|
||||
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
|
||||
self.headTypeView.isShowFirstRecharge = userInfo.isFirstCharge;
|
||||
self.giftBarView.isShowFirstRecharge = userInfo.isFirstCharge;
|
||||
self.giftInfoView.curUserNobleLevel = userInfo.userVipInfoVO.vipLevel;
|
||||
}
|
||||
@@ -639,4 +667,12 @@
|
||||
return _graffitiView;
|
||||
}
|
||||
|
||||
- (XPGiftHeadTypeView *)headTypeView {
|
||||
if (!_headTypeView) {
|
||||
_headTypeView = [[XPGiftHeadTypeView alloc] init];
|
||||
_headTypeView.delegate = self;
|
||||
}
|
||||
return _headTypeView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user