礼物面板增加周星礼物tab
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "GiftNobleInfoModel.h"
|
||||
#import "XPWeekStarRankUserModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
//礼物类型
|
||||
@@ -15,6 +16,7 @@ typedef NS_ENUM(NSUInteger, GiftType) {
|
||||
GiftType_Lucky = 3, // 福袋礼物
|
||||
GiftType_LuckyPool = 5, //福袋奖池礼物
|
||||
GiftType_Noble = 7, // 贵族礼物
|
||||
GiftType_WeekStar = 8, //周星礼物
|
||||
};
|
||||
|
||||
//礼物类型
|
||||
@@ -102,6 +104,14 @@ typedef NS_ENUM(NSUInteger, RoomSendGiftType) {
|
||||
///贵族礼物专属信息
|
||||
@property (nonatomic, strong) GiftNobleInfoModel *giftVipInfo;
|
||||
|
||||
/*----------周星礼物--------*/
|
||||
///上周周星礼物ID
|
||||
@property (nonatomic, assign) NSInteger lastGiftId;
|
||||
///上周对应礼物的魅力榜第一
|
||||
@property (nonatomic, strong) XPWeekStarRankUserModel *firstCharmRankUser;
|
||||
///上周对应礼物豪气榜第一
|
||||
@property (nonatomic, strong) XPWeekStarRankUserModel *firstLevelRankUser;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// XPCharmRankUserModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/5/7.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPWeekStarRankUserModel : NSObject
|
||||
|
||||
///头像
|
||||
@property (nonatomic, copy) NSString *avatar;
|
||||
///榜单值
|
||||
@property (nonatomic, assign) NSInteger amount;
|
||||
///uid
|
||||
@property (nonatomic, assign) NSInteger uid;
|
||||
///二般号
|
||||
@property (nonatomic, assign) NSInteger erbanNo;
|
||||
///昵称
|
||||
@property (nonatomic, copy) NSString *nick;
|
||||
///礼物id
|
||||
@property (nonatomic, assign) NSInteger giftId;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// XPCharmRankUserModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/5/7.
|
||||
//
|
||||
|
||||
#import "XPWeekStarRankUserModel.h"
|
||||
|
||||
@implementation XPWeekStarRankUserModel
|
||||
|
||||
@end
|
@@ -48,11 +48,13 @@
|
||||
NSArray *vipGift = [GiftInfoModel modelsWithArray:data.data[@"vipGift"]]; // 贵族礼物
|
||||
NSArray *luckyPoolGift = [GiftInfoModel modelsWithArray:data.data[@"luckyPoolGift"]];// 福袋奖池礼物
|
||||
NSArray *normalGift = [GiftInfoModel modelsWithArray:data.data[@"normalGift"]]; // 普通面板礼物
|
||||
NSArray *weekStarGift = [GiftInfoModel modelsWithArray:data.data[@"weekStarGift"]]; // 周星礼物
|
||||
NSMutableArray *info = [NSMutableArray array];
|
||||
NSMutableArray *totalInfo = [NSMutableArray array];
|
||||
[info addObjectsFromArray:luckyBagGift];
|
||||
[info addObjectsFromArray:vipGift];
|
||||
[info addObjectsFromArray:normalGift];
|
||||
[info addObjectsFromArray:weekStarGift];
|
||||
[totalInfo addObjectsFromArray:info];
|
||||
[totalInfo addObjectsFromArray:luckyPoolGift];
|
||||
///把礼物信息保存一下
|
||||
|
@@ -20,9 +20,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (UIColor *)giftBalanceColor;
|
||||
/// 送礼物 分页指示器的颜色
|
||||
+ (UIColor *)giftPageIndicatorColor;
|
||||
/// 分段控制器文字默认的颜色 #0C0B0C
|
||||
/// 分段控制器文字默认的颜色 #999999
|
||||
+ (UIColor *)giftSegmentNormalTitleColor;
|
||||
/// 分段控制器文字选中的颜色 #FFFFFF
|
||||
/// 分段控制器文字选中的颜色 #FFBC51
|
||||
+ (UIColor *)giftSegmentSelectTitleColor;
|
||||
/// 礼物选中的时候的颜色 0xFF903E
|
||||
+ (UIColor *)giftNameSelectColor;
|
||||
|
@@ -32,13 +32,13 @@
|
||||
+ (UIColor *)giftPageIndicatorColor {
|
||||
return [UIColor whiteColor];
|
||||
}
|
||||
/// 分段控制器文字默认的颜色 #0C0B0C
|
||||
/// 分段控制器文字默认的颜色 #999999
|
||||
+ (UIColor *)giftSegmentNormalTitleColor {
|
||||
return UIColorRGBAlpha(0xFFFFFF, 0.3);
|
||||
return UIColorRGBAlpha(0x999999, 1);
|
||||
}
|
||||
/// 分段控制器文字选中的颜色 #FFFFFF
|
||||
/// 分段控制器文字选中的颜色 #FFBC51
|
||||
+ (UIColor *)giftSegmentSelectTitleColor {
|
||||
return UIColorRGBAlpha(0xFFFFFF, 1);
|
||||
return UIColorRGBAlpha(0xFFBC51, 1);
|
||||
}
|
||||
/// 礼物选中的时候的颜色 0xFF903E
|
||||
+ (UIColor *)giftNameSelectColor {
|
||||
|
@@ -13,6 +13,7 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
|
||||
GiftSegmentType_Normal = 1, ///普通的礼物
|
||||
GiftSegmentType_Lucky,///幸运礼物
|
||||
GiftSegmentType_Noble,///贵族礼物
|
||||
GiftSegmentType_WeekStar, ///周星礼物
|
||||
GiftSegmentType_Pack,///背包礼物
|
||||
};
|
||||
|
||||
@@ -30,6 +31,9 @@ typedef NS_ENUM(NSInteger, GiftSegmentType) {
|
||||
///点击了贵族特权
|
||||
- (void)xPGiftInfoViewDidClickNobleEntrance:(XPGiftInfoView *)view;
|
||||
|
||||
///点击了周星榜
|
||||
- (void)xpGiftInfoViewDidClickWeekStarRank:(XPGiftInfoView *)view;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPGiftInfoView : UIView
|
||||
|
@@ -18,7 +18,9 @@
|
||||
#import "XPGiftItemCollectionViewCell.h"
|
||||
#import "XPGiftEmptyCollectionViewCell.h"
|
||||
#import "XPGiftCollectionViewFlowLayout.h"
|
||||
@interface XPGiftInfoView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
||||
#import "XPWeekStarInfoView.h"
|
||||
|
||||
@interface XPGiftInfoView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, XPWeekStarInfoViewDelegate>
|
||||
///
|
||||
@property (nonatomic,strong) UIStackView *segmentStackView;
|
||||
///普通礼物
|
||||
@@ -29,6 +31,8 @@
|
||||
@property (nonatomic,strong) UIButton *luckyGiftButton;
|
||||
///贵族礼物
|
||||
@property (nonatomic,strong) UIButton *nobleGiftButton;
|
||||
///周星礼物
|
||||
@property (nonatomic, strong) UIButton *weekStarButton;
|
||||
///占位的
|
||||
@property (nonatomic,strong) UIView * segmentPlaceView;
|
||||
///玩法规则的
|
||||
@@ -39,6 +43,8 @@
|
||||
@property (nonatomic, strong) UIButton *nobleButton;
|
||||
///
|
||||
@property (nonatomic,strong) UIStackView *giftStackView;
|
||||
///周星榜用户信息
|
||||
@property (nonatomic, strong) XPWeekStarInfoView *weekStarView;
|
||||
///l礼物列表
|
||||
@property (nonatomic,strong) UICollectionView *giftcollectionView;
|
||||
///分页控件
|
||||
@@ -51,6 +57,8 @@
|
||||
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftLuckyArray;
|
||||
///贵族礼物的数据源
|
||||
@property (nonatomic, strong) NSArray<GiftInfoModel *> *giftNobleArray;
|
||||
///周星礼物的数据源
|
||||
@property (nonatomic, strong) NSArray<GiftInfoModel *> *giftWeekStarArray;
|
||||
/////背包礼物的数据源
|
||||
@property (nonatomic,strong) NSArray<GiftInfoModel *> *giftPackArray;
|
||||
///总的价值
|
||||
@@ -79,6 +87,7 @@
|
||||
self.luckyGiftButton.selected = NO;
|
||||
self.nobleGiftButton.selected = NO;
|
||||
self.packGiftButton.selected = NO;
|
||||
self.weekStarButton.selected = NO;
|
||||
sender.selected = !sender.selected;
|
||||
self.segmentType = sender.tag;
|
||||
}
|
||||
@@ -113,11 +122,14 @@
|
||||
[self.segmentStackView addArrangedSubview:self.normalGiftButton];
|
||||
[self.segmentStackView addArrangedSubview:self.luckyGiftButton];
|
||||
[self.segmentStackView addArrangedSubview:self.nobleGiftButton];
|
||||
[self.segmentStackView addArrangedSubview:self.weekStarButton];
|
||||
[self.segmentStackView addArrangedSubview:self.packGiftButton];
|
||||
[self.segmentStackView addArrangedSubview:self.segmentPlaceView];
|
||||
[self.segmentStackView addArrangedSubview:self.playRuleButton];
|
||||
[self.segmentStackView addArrangedSubview:self.totalValueLabel];
|
||||
[self.segmentStackView addArrangedSubview:self.nobleButton];
|
||||
///周星榜信息
|
||||
[self addSubview:self.weekStarView];
|
||||
///礼物
|
||||
[self.giftStackView addArrangedSubview:self.giftcollectionView];
|
||||
[self.giftStackView addArrangedSubview:self.pageController];
|
||||
@@ -125,18 +137,24 @@
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(40 + 108 * 2 + 10 + 10);
|
||||
make.height.mas_equalTo(30 + 108 * 2 + 10 + 10 + 25);
|
||||
}];
|
||||
|
||||
|
||||
[self.segmentStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(15);
|
||||
make.top.mas_equalTo(self);
|
||||
make.height.mas_equalTo(40);
|
||||
}];
|
||||
|
||||
[self.segmentStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(15);
|
||||
make.top.mas_equalTo(self);
|
||||
make.height.mas_equalTo(30);
|
||||
}];
|
||||
|
||||
[self.weekStarView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self).inset(15);
|
||||
make.top.mas_equalTo(self.segmentStackView.mas_bottom);
|
||||
make.height.mas_equalTo(25);
|
||||
}];
|
||||
|
||||
[self.giftStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.segmentStackView.mas_bottom);
|
||||
make.top.mas_equalTo(self.weekStarView.mas_bottom);
|
||||
make.left.right.mas_equalTo(self);
|
||||
make.height.mas_equalTo(108 * 2 + 20);
|
||||
}];
|
||||
@@ -191,6 +209,10 @@
|
||||
}
|
||||
self.playRuleButton.hidden = giftInfo.giftExplainUrl.length <= 0;
|
||||
giftInfo.isSelected = YES;
|
||||
if (self.segmentType == GiftSegmentType_WeekStar) {
|
||||
self.weekStarView.firstCharmRankUser = giftInfo.firstCharmRankUser;
|
||||
self.weekStarView.firstLevelRankUser = giftInfo.firstLevelRankUser;
|
||||
}
|
||||
}
|
||||
|
||||
// 根据礼物id查找
|
||||
@@ -252,6 +274,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPWeekStarInfoViewDelegate
|
||||
- (void)xPWeekStarInfoViewRankButtonClick {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xpGiftInfoViewDidClickWeekStarRank:)]) {
|
||||
[self.delegate xpGiftInfoViewDidClickWeekStarRank:self];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setSegmentType:(GiftSegmentType)segmentType {
|
||||
if (segmentType == _segmentType) {
|
||||
@@ -263,8 +292,10 @@
|
||||
[self resetSelectGift:self.packOriginArray];
|
||||
[self resetSelectGift:self.giftLuckyArray];
|
||||
[self resetSelectGift:self.giftNobleArray];
|
||||
[self resetSelectGift:self.giftWeekStarArray];
|
||||
self.totalValueLabel.hidden = YES;
|
||||
self.nobleButton.hidden = YES;
|
||||
self.weekStarView.hidden = YES;
|
||||
switch (_segmentType) {
|
||||
case GiftSegmentType_Normal:
|
||||
[self.datasource addObjectsFromArray:self.giftArray];
|
||||
@@ -272,9 +303,15 @@
|
||||
case GiftSegmentType_Lucky:
|
||||
[self.datasource addObjectsFromArray:self.giftLuckyArray];
|
||||
break;
|
||||
case GiftSegmentType_Noble:
|
||||
case GiftSegmentType_Noble: {
|
||||
[self.datasource addObjectsFromArray:self.giftNobleArray];
|
||||
self.nobleButton.hidden = NO;
|
||||
}
|
||||
break;
|
||||
case GiftSegmentType_WeekStar: {
|
||||
[self.datasource addObjectsFromArray:self.giftWeekStarArray];
|
||||
self.weekStarView.hidden = NO;
|
||||
}
|
||||
break;
|
||||
case GiftSegmentType_Pack:
|
||||
{
|
||||
@@ -314,6 +351,7 @@
|
||||
NSMutableArray * luckyArray = [NSMutableArray array];
|
||||
NSMutableArray * normaleArray = [NSMutableArray array];
|
||||
NSMutableArray * nobleArray = [NSMutableArray array];
|
||||
NSMutableArray * weekStarArray = [NSMutableArray array];
|
||||
[_normalOriginArray enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.giftType == GiftType_Lucky) {
|
||||
[luckyArray addObject:obj];
|
||||
@@ -321,11 +359,14 @@
|
||||
[normaleArray addObject:obj];
|
||||
} else if (obj.giftType == GiftType_Noble) {
|
||||
[nobleArray addObject:obj];
|
||||
} else if (obj.giftType == GiftType_WeekStar) {
|
||||
[weekStarArray addObject:obj];
|
||||
}
|
||||
}];
|
||||
self.giftArray = normaleArray;
|
||||
self.giftLuckyArray = luckyArray;
|
||||
self.giftNobleArray = nobleArray;
|
||||
self.giftWeekStarArray = weekStarArray;
|
||||
self.segmentType = GiftSegmentType_Normal;
|
||||
}
|
||||
|
||||
@@ -362,6 +403,14 @@
|
||||
return _giftStackView;
|
||||
}
|
||||
|
||||
- (XPWeekStarInfoView *)weekStarView {
|
||||
if (!_weekStarView) {
|
||||
_weekStarView = [[XPWeekStarInfoView alloc] init];
|
||||
_weekStarView.delegate = self;
|
||||
}
|
||||
return _weekStarView;
|
||||
}
|
||||
|
||||
- (UIButton *)normalGiftButton {
|
||||
if (!_normalGiftButton) {
|
||||
_normalGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
@@ -379,7 +428,7 @@
|
||||
- (UIButton *)luckyGiftButton {
|
||||
if (!_luckyGiftButton) {
|
||||
_luckyGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_luckyGiftButton setTitle:@"幸运礼物" forState:UIControlStateNormal];
|
||||
[_luckyGiftButton setTitle:@"幸运" forState:UIControlStateNormal];
|
||||
[_luckyGiftButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
|
||||
[_luckyGiftButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
|
||||
_luckyGiftButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
@@ -393,7 +442,7 @@
|
||||
- (UIButton *)nobleGiftButton {
|
||||
if (!_nobleGiftButton) {
|
||||
_nobleGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_nobleGiftButton setTitle:@"贵族礼物" forState:UIControlStateNormal];
|
||||
[_nobleGiftButton setTitle:@"贵族" forState:UIControlStateNormal];
|
||||
[_nobleGiftButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
|
||||
[_nobleGiftButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
|
||||
_nobleGiftButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
@@ -404,6 +453,20 @@
|
||||
return _nobleGiftButton;
|
||||
}
|
||||
|
||||
- (UIButton *)weekStarButton {
|
||||
if (!_weekStarButton) {
|
||||
_weekStarButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_weekStarButton setTitle:@"周星" forState:UIControlStateNormal];
|
||||
[_weekStarButton setTitleColor:[ThemeColor giftSegmentSelectTitleColor] forState:UIControlStateSelected];
|
||||
[_weekStarButton setTitleColor:[ThemeColor giftSegmentNormalTitleColor] forState:UIControlStateNormal];
|
||||
_weekStarButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
_weekStarButton.tag = GiftSegmentType_WeekStar;
|
||||
_weekStarButton.selected = NO;
|
||||
[_weekStarButton addTarget:self action:@selector(didClickGiftSegmentAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _weekStarButton;
|
||||
}
|
||||
|
||||
- (UIButton *)packGiftButton {
|
||||
if (!_packGiftButton) {
|
||||
_packGiftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#import "TTPopup.h"
|
||||
#import "ThemeColor+SendGift.h"
|
||||
#import "StatisticsServiceHelper.h"
|
||||
#import "XPHtmlUrl.h"
|
||||
///Model
|
||||
#import "GiftInfoModel.h"
|
||||
#import "XPGiftCountModel.h"
|
||||
@@ -358,6 +359,14 @@
|
||||
[self.delegate.getCurrentNav pushViewController:nobleVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)xpGiftInfoViewDidClickWeekStarRank:(XPGiftInfoView *)view {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
||||
webVC.roomUid = self.roomUid;
|
||||
webVC.url = URLWithType(kNewWeekStarURL);
|
||||
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - XPGiftProtocol
|
||||
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo {
|
||||
self.giftBarView.walletInfoModel = balanceInfo;
|
||||
|
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// XPWeekStarInfoView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/5/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class XPWeekStarRankUserModel;
|
||||
|
||||
@protocol XPWeekStarInfoViewDelegate <NSObject>
|
||||
|
||||
///周星榜点击
|
||||
- (void)xPWeekStarInfoViewRankButtonClick;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPWeekStarInfoView : UIView
|
||||
|
||||
///上周对应礼物的魅力榜第一
|
||||
@property (nonatomic, strong) XPWeekStarRankUserModel *firstCharmRankUser;
|
||||
///上周对应礼物豪气榜第一
|
||||
@property (nonatomic, strong) XPWeekStarRankUserModel *firstLevelRankUser;
|
||||
|
||||
@property (nonatomic, weak) id<XPWeekStarInfoViewDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
178
xplan-ios/Main/ModuleKit/SendGiftView/View/XPWeekStarInfoView.m
Normal file
178
xplan-ios/Main/ModuleKit/SendGiftView/View/XPWeekStarInfoView.m
Normal file
@@ -0,0 +1,178 @@
|
||||
//
|
||||
// XPWeekStarInfoView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/5/7.
|
||||
//
|
||||
|
||||
#import "XPWeekStarInfoView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "XPMacro.h"
|
||||
#import "ThemeColor+SendGift.h"
|
||||
///Model
|
||||
#import "XPWeekStarRankUserModel.h"
|
||||
|
||||
@interface XPWeekStarInfoView()
|
||||
|
||||
///冠名者标题
|
||||
@property (nonatomic, strong) UILabel *charmTitleLabel;
|
||||
///神豪标题
|
||||
@property (nonatomic, strong) UILabel *contributeTitleLabel;
|
||||
///冠名者
|
||||
@property (nonatomic, strong) UILabel *charmLabel;
|
||||
///神豪
|
||||
@property (nonatomic, strong) UILabel *contributeLabel;
|
||||
///周星版入口
|
||||
@property (nonatomic, strong) UIButton *entranceButton;
|
||||
///箭头
|
||||
@property (nonatomic, strong) UIImageView *arrowImageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPWeekStarInfoView
|
||||
|
||||
- (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.charmTitleLabel];
|
||||
[self addSubview:self.contributeTitleLabel];
|
||||
[self addSubview:self.charmLabel];
|
||||
[self addSubview:self.contributeLabel];
|
||||
[self addSubview:self.entranceButton];
|
||||
[self addSubview:self.arrowImageView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.charmTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.mas_equalTo(0);
|
||||
make.height.mas_equalTo(14);
|
||||
}];
|
||||
[self.charmLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.charmTitleLabel.mas_right);
|
||||
make.centerY.mas_equalTo(self.charmTitleLabel);
|
||||
}];
|
||||
|
||||
[self.contributeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.charmLabel.mas_right).mas_offset(16);
|
||||
make.centerY.mas_equalTo(self.charmTitleLabel);
|
||||
}];
|
||||
|
||||
[self.contributeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.contributeTitleLabel.mas_right);
|
||||
make.centerY.mas_equalTo(self.charmTitleLabel);
|
||||
}];
|
||||
|
||||
[self.entranceButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.arrowImageView.mas_left).mas_offset(-4);
|
||||
make.width.mas_equalTo(48);
|
||||
make.height.mas_equalTo(14);
|
||||
make.centerY.mas_equalTo(self.charmTitleLabel);
|
||||
}];
|
||||
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(0);
|
||||
make.width.mas_equalTo(7);
|
||||
make.height.mas_equalTo(10);
|
||||
make.centerY.mas_equalTo(self.charmTitleLabel);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - events
|
||||
- (void)didClickWeekStarRank:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPWeekStarInfoViewRankButtonClick)]) {
|
||||
[self.delegate xPWeekStarInfoViewRankButtonClick];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - getter and setter
|
||||
- (void)setFirstCharmRankUser:(XPWeekStarRankUserModel *)firstCharmRankUser {
|
||||
NSString *nickStr = firstCharmRankUser.nick;
|
||||
if (firstCharmRankUser.nick.length > 5) {
|
||||
nickStr = [NSString stringWithFormat:@"%@…", [firstCharmRankUser.nick substringToIndex:5]];
|
||||
} else if(!firstCharmRankUser.nick.length) {
|
||||
nickStr = @"";
|
||||
}
|
||||
self.charmLabel.text = nickStr;
|
||||
}
|
||||
|
||||
- (void)setFirstLevelRankUser:(XPWeekStarRankUserModel *)firstLevelRankUser {
|
||||
NSString *nickStr = firstLevelRankUser.nick;
|
||||
if (firstLevelRankUser.nick.length > 5) {
|
||||
nickStr = [NSString stringWithFormat:@"%@…", [firstLevelRankUser.nick substringToIndex:5]];
|
||||
} else if(!firstLevelRankUser.nick.length) {
|
||||
nickStr = @"";
|
||||
}
|
||||
self.contributeLabel.text = nickStr;
|
||||
}
|
||||
|
||||
- (UILabel *)charmTitleLabel {
|
||||
if (!_charmTitleLabel) {
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.font = [UIFont systemFontOfSize:10];
|
||||
label.textColor = [ThemeColor giftSegmentNormalTitleColor];
|
||||
label.text = @"本周冠名者:";
|
||||
_charmTitleLabel = label;
|
||||
}
|
||||
return _charmTitleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)contributeTitleLabel {
|
||||
if (!_contributeTitleLabel) {
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.font = [UIFont systemFontOfSize:10];
|
||||
label.textColor = [ThemeColor giftSegmentNormalTitleColor];
|
||||
label.text = @"周星神豪:";
|
||||
_contributeTitleLabel = label;
|
||||
}
|
||||
return _contributeTitleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)charmLabel {
|
||||
if (!_charmLabel) {
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.font = [UIFont systemFontOfSize:10];
|
||||
label.textColor = [ThemeColor giftSegmentSelectTitleColor];
|
||||
_charmLabel = label;
|
||||
}
|
||||
return _charmLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)contributeLabel {
|
||||
if (!_contributeLabel) {
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.font = [UIFont systemFontOfSize:10];
|
||||
label.textColor = [ThemeColor giftSegmentSelectTitleColor];
|
||||
_contributeLabel = label;
|
||||
}
|
||||
return _contributeLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)entranceButton {
|
||||
if (!_entranceButton) {
|
||||
_entranceButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_entranceButton.adjustsImageWhenHighlighted = NO;
|
||||
[_entranceButton setBackgroundImage:[UIImage imageNamed:@"gift_bar_weekStar_button"] forState:UIControlStateNormal];
|
||||
[_entranceButton addTarget:self action:@selector(didClickWeekStarRank:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _entranceButton;
|
||||
}
|
||||
|
||||
- (UIImageView *)arrowImageView {
|
||||
if (!_arrowImageView) {
|
||||
_arrowImageView = [[UIImageView alloc] init];
|
||||
_arrowImageView.image = [UIImage imageNamed:@"gift_bar_weekStar_arrow"];
|
||||
}
|
||||
return _arrowImageView;
|
||||
}
|
||||
|
||||
@end
|
Reference in New Issue
Block a user