爵位完成
This commit is contained in:
@@ -55,6 +55,7 @@ typedef NS_ENUM(NSInteger) {
|
||||
@interface QXMainHeaderView : UIView
|
||||
@property (nonatomic,weak)id<QXMainHeaderViewDelegate>delegate;
|
||||
@property (nonatomic,strong)QXUserModel *userModel;
|
||||
@property (nonatomic,strong)NSArray *bannerArray;
|
||||
@property (nonatomic,strong)NSString *earnings;
|
||||
@property (nonatomic,strong)NSString *coin;
|
||||
-(void)reloadData;
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
#import "CKShimmerLabel.h"
|
||||
#import "QXMineHomeToolsCell.h"
|
||||
#import "QXServiceModel.h"
|
||||
#import "QXBanner.h"
|
||||
#import <SDCycleScrollView/SDCycleScrollView.h>
|
||||
#import "QXUserHomePageViewController.h"
|
||||
|
||||
@interface QXMainHeaderView()<UICollectionViewDelegate,UICollectionViewDataSource,SDCycleScrollViewDelegate>
|
||||
@property (nonatomic, strong) QXSeatHeaderView *userHeaderView;
|
||||
@@ -57,6 +59,7 @@
|
||||
@property (nonatomic, strong)UIImageView *giftWallBgImageView;
|
||||
@property (nonatomic, strong)UILabel *giftWallTitleLabel;
|
||||
@property (nonatomic, strong)UIButton *giftWallBtn;
|
||||
@property (nonatomic, strong)NSMutableArray *bannerImages;
|
||||
@end
|
||||
@implementation QXMainHeaderView
|
||||
|
||||
@@ -70,7 +73,7 @@
|
||||
}
|
||||
-(void)initSubviews{
|
||||
MJWeakSelf
|
||||
self.userHeaderView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(16, 18, 76, 76)];
|
||||
self.userHeaderView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(16, 18, 76, 91)];
|
||||
[self.userHeaderView addTapBlock:^(id _Nonnull obj) {
|
||||
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickOptionType:)]) {
|
||||
[weakSelf.delegate didClickOptionType:QXMainHeaderOptionTypeGotoHome];
|
||||
@@ -78,12 +81,7 @@
|
||||
}];
|
||||
[self addSubview:self.userHeaderView];
|
||||
|
||||
self.sexImageView = [[UIImageView alloc] init];
|
||||
[self addSubview:self.sexImageView];
|
||||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.bottom.equalTo(self.userHeaderView);
|
||||
make.height.width.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
|
||||
// self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.userHeaderView.top, self.width-self.userHeaderView.right-16-6, 23)];
|
||||
self.nameLabel = [[CKShimmerLabel alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.userHeaderView.top+5, self.width-self.userHeaderView.right-16-6, 22)];
|
||||
@@ -96,7 +94,14 @@
|
||||
// [self.nameLabel startShimmer];
|
||||
[self addSubview:self.nameLabel];
|
||||
|
||||
self.idLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.nameLabel.bottom+6, 80, 17)];
|
||||
self.sexImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.userHeaderView.right+6, self.nameLabel.bottom+4, 17, 17)];
|
||||
[self addSubview:self.sexImageView];
|
||||
// [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.right.bottom.equalTo(self.userHeaderView);
|
||||
// make.height.width.mas_equalTo(16);
|
||||
// }];
|
||||
|
||||
self.idLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.sexImageView.right+6, self.nameLabel.bottom+6, 80, 17)];
|
||||
self.idLabel.textColor = RGB16(0x666666);
|
||||
self.idLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.idLabel.text = @"ID:";
|
||||
@@ -142,7 +147,7 @@
|
||||
];
|
||||
CGFloat width = (SCREEN_WIDTH-60)/3;
|
||||
for (int i = 0; i < nameArr.count; i ++) {
|
||||
UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(30+width*i, self.userHeaderView.bottom+25, width, 25)];
|
||||
UILabel *countLabel = [[UILabel alloc] initWithFrame:CGRectMake(30+width*i, self.userHeaderView.bottom+10, width, 25)];
|
||||
countLabel.textAlignment = NSTextAlignmentCenter;
|
||||
countLabel.textColor = RGB16(0xCCCDC8);
|
||||
countLabel.tag = 10 + i;
|
||||
@@ -166,7 +171,7 @@
|
||||
}
|
||||
|
||||
|
||||
self.nobilityBgView = [[UIView alloc] initWithFrame:CGRectMake(30, self.userHeaderView.bottom+95, SCREEN_WIDTH-60, ScaleWidth(40))];
|
||||
self.nobilityBgView = [[UIView alloc] initWithFrame:CGRectMake(30, self.userHeaderView.bottom+80, SCREEN_WIDTH-60, ScaleWidth(40))];
|
||||
[self.nobilityBgView addTapBlock:^(id _Nonnull obj) {
|
||||
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickOptionType:)]) {
|
||||
[weakSelf.delegate didClickOptionType:QXMainHeaderOptionTypeNobility];
|
||||
@@ -282,6 +287,33 @@
|
||||
_coin = coin;
|
||||
self.walletMoneyLabel.text = [NSString stringWithFormat:@"%.2f",coin.doubleValue];
|
||||
}
|
||||
-(void)setBannerArray:(NSArray *)bannerArray{
|
||||
_bannerArray = bannerArray;
|
||||
[self.bannerImages removeAllObjects];
|
||||
for (QXBanner *banner in bannerArray) {
|
||||
[self.bannerImages addObject:banner.image];
|
||||
}
|
||||
self.cycleScrollView.imageURLStringsGroup = self.bannerImages;
|
||||
}
|
||||
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
|
||||
if (!QXGlobal.shareGlobal.isLogin) {
|
||||
[[QXGlobal shareGlobal] logOut];
|
||||
return;
|
||||
}
|
||||
QXBanner *banner = self.bannerArray[index];
|
||||
if ([banner.type isEqualToString:@"2"]) {
|
||||
QXBaseWebViewController *webVc = [[QXBaseWebViewController alloc] init];
|
||||
webVc.urlStr = banner.url;
|
||||
[self.navigationController pushViewController:webVc animated:YES];
|
||||
}else if ([banner.type isEqualToString:@"3"]){
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:banner.aid isRejoin:NO navagationController:self.navigationController];
|
||||
}else if ([banner.type isEqualToString:@"4"]){
|
||||
QXUserHomePageViewController *userHomePage = [[QXUserHomePageViewController alloc] init];
|
||||
userHomePage.user_id = banner.aid;
|
||||
[self.viewController.navigationController pushViewController:userHomePage animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)reloadData{
|
||||
if ([self.toolsArray containsObject:self.rechargeModel]) {
|
||||
return;
|
||||
@@ -333,6 +365,12 @@
|
||||
-(void)setUserModel:(QXUserModel *)userModel{
|
||||
_userModel = userModel;
|
||||
[self.userHeaderView setHeadIcon:userModel.avatar dress:userModel.dress];
|
||||
[self.userHeaderView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:userModel.nobility_image]];
|
||||
if ([userModel.nickname_color isExist]) {
|
||||
self.nameLabel.textColor = [UIColor colorWithHexString:userModel.nickname_color];
|
||||
}else{
|
||||
self.nameLabel.textColor = RGB16A(0xffffff,0.85);
|
||||
}
|
||||
self.nameLabel.text = userModel.nickname;
|
||||
self.idLabel.text = [NSString stringWithFormat:@"ID:%@",userModel.user_code];
|
||||
UILabel *followLabel = [self viewWithTag:10];
|
||||
@@ -346,7 +384,7 @@
|
||||
}
|
||||
for (int i = 0;i<userModel.icon.count;i++) {
|
||||
NSString*icon = userModel.icon[i];
|
||||
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.nameLabel.left+i*UserIconWidth, self.userHeaderView.bottom-5-UserIconHeight, UserIconWidth, UserIconHeight)];
|
||||
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.nameLabel.left+i*UserIconWidth, self.idLabel.bottom+9, UserIconWidth, UserIconHeight)];
|
||||
[imageView sd_setImageWithURL:[NSURL URLWithString:icon]];
|
||||
[self addSubview:imageView];
|
||||
[self.iconArray addObject:imageView];
|
||||
@@ -415,4 +453,10 @@
|
||||
}
|
||||
return _rechargeModel;
|
||||
}
|
||||
-(NSMutableArray *)bannerImages{
|
||||
if (!_bannerImages) {
|
||||
_bannerImages = [NSMutableArray array];
|
||||
}
|
||||
return _bannerImages;
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
|
||||
QXServiceModel *md3 = [[QXServiceModel alloc] init];
|
||||
md3.title = @"意见反馈";
|
||||
md3.icon = @"service_bag";
|
||||
md3.icon = @"service_report";
|
||||
md3.type = QXMineServiceTypeReport;
|
||||
|
||||
QXServiceModel *md4 = [[QXServiceModel alloc] init];
|
||||
|
||||
@@ -51,16 +51,12 @@
|
||||
[self addSubview:self.headerView];
|
||||
[self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(32);
|
||||
make.height.width.mas_equalTo(70);
|
||||
make.width.mas_equalTo(70);
|
||||
make.height.mas_equalTo(84);
|
||||
make.top.mas_equalTo(26);
|
||||
}];
|
||||
|
||||
self.sexImageView = [[UIImageView alloc] init];
|
||||
[self addSubview:self.sexImageView];
|
||||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.bottom.equalTo(self.headerView);
|
||||
make.height.width.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
|
||||
self.nameLabel = [[UILabel alloc] init];
|
||||
self.nameLabel.textColor = QXConfig.textColor;
|
||||
@@ -72,12 +68,20 @@
|
||||
make.top.equalTo(self.headerView.mas_bottom).offset(4);
|
||||
}];
|
||||
|
||||
self.sexImageView = [[UIImageView alloc] init];
|
||||
[self addSubview:self.sexImageView];
|
||||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.nameLabel.mas_right).offset(5);
|
||||
make.centerY.equalTo(self.nameLabel);
|
||||
make.height.width.mas_equalTo(16);
|
||||
}];
|
||||
|
||||
self.idLabel = [[UILabel alloc] init];
|
||||
self.idLabel.textColor = RGB16(0x999999);
|
||||
self.idLabel.font = [UIFont boldSystemFontOfSize:12];
|
||||
[self addSubview:self.idLabel];
|
||||
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.nameLabel.mas_right).offset(12);
|
||||
make.left.equalTo(self.sexImageView.mas_right).offset(12);
|
||||
make.height.mas_equalTo(24);
|
||||
make.centerY.equalTo(self.nameLabel);
|
||||
}];
|
||||
@@ -267,7 +271,13 @@
|
||||
-(void)setModel:(QXUserHomeModel *)model{
|
||||
_model = model;
|
||||
[self.headerView setHeadIcon:model.avatar dress:model.dress];
|
||||
[self.headerView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]];
|
||||
self.nameLabel.text = model.nickname;
|
||||
if ([model.nickname_color isExist]) {
|
||||
self.nameLabel.textColor = [UIColor colorWithHexString:model.nickname_color];
|
||||
}else{
|
||||
self.nameLabel.textColor = QXConfig.textColor;
|
||||
}
|
||||
self.idLabel.text = [NSString stringWithFormat:@"ID:%@",model.user_code];
|
||||
self.ageLabel.text = [NSString stringWithFormat:@"%@|%ld岁",model.sex.intValue==1?QXText(@"男"):QXText(@"女"),[model.birthday ageWithDateOfBirth]];
|
||||
self.introduceLabel.text = model.profile;
|
||||
|
||||
17
QXLive/Mine(音域)/View/充值/QXRechargePayTypeTableCell.h
Normal file
17
QXLive/Mine(音域)/View/充值/QXRechargePayTypeTableCell.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXRechargePayTypeTableCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXRechargePayTypeView.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRechargePayTypeTableCell : UITableViewCell
|
||||
@property (nonatomic,strong)QXPayTypeModel *model;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
56
QXLive/Mine(音域)/View/充值/QXRechargePayTypeTableCell.m
Normal file
56
QXLive/Mine(音域)/View/充值/QXRechargePayTypeTableCell.m
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// QXRechargePayTypeTableCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/8.
|
||||
//
|
||||
|
||||
#import "QXRechargePayTypeTableCell.h"
|
||||
@interface QXRechargePayTypeTableCell()
|
||||
@property (nonatomic,strong)QXRechargePayTypeView *payTypeView;
|
||||
@end
|
||||
@implementation QXRechargePayTypeTableCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXRechargePayTypeTableCell";
|
||||
QXRechargePayTypeTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[QXRechargePayTypeTableCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
self.backgroundColor = UIColor.clearColor;
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)setModel:(QXPayTypeModel *)model{
|
||||
_model = model;
|
||||
self.payTypeView.model = model;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.payTypeView = [[QXRechargePayTypeView alloc] init];
|
||||
[self.contentView addSubview:self.payTypeView];
|
||||
[self.payTypeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.right.mas_equalTo(-16);
|
||||
make.top.bottom.equalTo(self);
|
||||
}];
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -266,7 +266,7 @@
|
||||
}
|
||||
|
||||
@weakify(self)
|
||||
[QXMineNetwork rechargePayWithMoney:self.selectedModel.money coin:self.selectedModel.coins type:self.selectedPayTypeModel.type userId:QXGlobal.shareGlobal.loginModel.user_id typeId:self.gift_bag_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[QXMineNetwork rechargePayWithMoney:self.selectedModel.money coin:self.selectedModel.coins type:self.selectedPayTypeModel.type userId:QXGlobal.shareGlobal.loginModel.user_id typeId:self.gift_bag_id nobility_id:@"" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
@strongify(self)
|
||||
if (self.selectedPayTypeModel.type.intValue == 2) {
|
||||
NSDictionary *resultDict = dict[@"data"];
|
||||
|
||||
17
QXLive/Mine(音域)/View/爵位/QXNobilityBuyDesCell.h
Normal file
17
QXLive/Mine(音域)/View/爵位/QXNobilityBuyDesCell.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXNobilityBuyDesCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXNobilityBuyDesCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
31
QXLive/Mine(音域)/View/爵位/QXNobilityBuyDesCell.m
Normal file
31
QXLive/Mine(音域)/View/爵位/QXNobilityBuyDesCell.m
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// QXNobilityBuyDesCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/7.
|
||||
//
|
||||
|
||||
#import "QXNobilityBuyDesCell.h"
|
||||
|
||||
@implementation QXNobilityBuyDesCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXNobilityBuyDesCell";
|
||||
QXNobilityBuyDesCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
55
QXLive/Mine(音域)/View/爵位/QXNobilityBuyDesCell.xib
Normal file
55
QXLive/Mine(音域)/View/爵位/QXNobilityBuyDesCell.xib
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="123" id="KGk-i7-Jjw" customClass="QXNobilityBuyDesCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="428" height="123"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="428" height="123"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="nobility_buy_right" translatesAutoresizingMaskIntoConstraints="NO" id="iv3-Qk-Sz9">
|
||||
<rect key="frame" x="16" y="51.666666666666664" width="20" height="19.999999999999993"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="1KK-NC-aPP"/>
|
||||
<constraint firstAttribute="width" constant="20" id="MB4-aI-H6f"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mbe-RV-FTv">
|
||||
<rect key="frame" x="46" y="0.0" width="372" height="123"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="0.84999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="Mbe-RV-FTv" secondAttribute="bottom" id="bdU-cC-yAv"/>
|
||||
<constraint firstItem="Mbe-RV-FTv" firstAttribute="leading" secondItem="iv3-Qk-Sz9" secondAttribute="trailing" constant="10" id="nvH-RN-gNj"/>
|
||||
<constraint firstItem="iv3-Qk-Sz9" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="p3e-oi-7MM"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Mbe-RV-FTv" secondAttribute="trailing" constant="10" id="uXt-vT-XiJ"/>
|
||||
<constraint firstItem="Mbe-RV-FTv" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="xtE-ts-Q7A"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<constraints>
|
||||
<constraint firstItem="iv3-Qk-Sz9" firstAttribute="centerY" secondItem="aW0-zy-SZf" secondAttribute="centerY" id="f41-7K-Iof"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<outlet property="titleLabel" destination="Mbe-RV-FTv" id="8Hk-Ou-mp3"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="221.37404580152671" y="47.535211267605639"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="nobility_buy_right" width="18" height="18"/>
|
||||
</resources>
|
||||
</document>
|
||||
26
QXLive/Mine(音域)/View/爵位/QXNobilityContentView.h
Normal file
26
QXLive/Mine(音域)/View/爵位/QXNobilityContentView.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// QXNobilityContentView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXNobilityModel.h"
|
||||
@class QXNobilityContentColView;
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXNobilityContentView : UIView
|
||||
@property (nonatomic, strong) QXNobilityModel *model;
|
||||
- (void)reloadData;
|
||||
@end
|
||||
|
||||
|
||||
@interface QXNobilityContentColView : UIView
|
||||
@property (nonatomic,strong)QXUserNobility *model;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIView *colorView;
|
||||
@property (nonatomic,strong)UIImageView *imageView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
437
QXLive/Mine(音域)/View/爵位/QXNobilityContentView.m
Normal file
437
QXLive/Mine(音域)/View/爵位/QXNobilityContentView.m
Normal file
@@ -0,0 +1,437 @@
|
||||
//
|
||||
// QXNobilityContentView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/7.
|
||||
//
|
||||
|
||||
#import "QXNobilityContentView.h"
|
||||
@interface QXNobilityContentView()<UIScrollViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *privilegeTitles;
|
||||
@property (nonatomic, assign) NSInteger rowCount;
|
||||
@property (nonatomic, strong) NSMutableArray *rowHeaders;
|
||||
|
||||
@property (nonatomic, assign) CGFloat rowHeaderWidth;
|
||||
@property (nonatomic, assign) CGFloat columnHeaderHeight;
|
||||
@property (nonatomic, assign) CGFloat cellWidth;
|
||||
@property (nonatomic, assign) CGFloat cellHeight;
|
||||
|
||||
// 滚动视图
|
||||
@property (nonatomic, strong) UIScrollView *verticalScrollView; // 处理垂直滚动
|
||||
@property (nonatomic, strong) UIScrollView *horizontalScrollView; // 处理水平滚动
|
||||
@property (nonatomic, strong) UIScrollView *contentScrollView; // 内容区域滚动
|
||||
@property (nonatomic, strong) UIScrollView *rowHeaderScrollView; // 行标题垂直滚动
|
||||
|
||||
// 固定视图
|
||||
@property (nonatomic, strong) UIView *cornerView; // 左上角
|
||||
@property (nonatomic, strong) UIView *columnHeaderView; // 列标题(第一行)
|
||||
|
||||
@property (nonatomic, strong)UILabel *cornerLabel;
|
||||
|
||||
// 内容容器
|
||||
@property (nonatomic, strong) UIView *contentContainer;
|
||||
@property (nonatomic, strong) UIView *rowHeaderContainer;
|
||||
|
||||
@property (nonatomic, strong) UIView *borderView;
|
||||
|
||||
@property (nonatomic, assign) BOOL isSyncingScroll;
|
||||
@property (nonatomic, assign) NSInteger currentIndex;
|
||||
@end
|
||||
@implementation QXNobilityContentView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self setup];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setup {
|
||||
self.clipsToBounds = YES;
|
||||
int itemWidth = (self.width/4);
|
||||
self.rowHeaderWidth = itemWidth;
|
||||
self.columnHeaderHeight = 50;
|
||||
self.cellWidth = itemWidth;
|
||||
self.cellHeight = 42;
|
||||
self.isSyncingScroll = NO;
|
||||
|
||||
[self createScrollViews];
|
||||
[self createFixedViews];
|
||||
[self createContentViews];
|
||||
|
||||
[self bringSubviewToFront:self.horizontalScrollView];
|
||||
[self bringSubviewToFront:self.rowHeaderScrollView];
|
||||
[self bringSubviewToFront:self.cornerView];
|
||||
[self bringSubviewToFront:self.contentScrollView];
|
||||
}
|
||||
|
||||
- (void)createScrollViews {
|
||||
// 主垂直滚动视图 - 占据整个视图,但只处理垂直滚动
|
||||
self.verticalScrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
|
||||
self.verticalScrollView.delegate = self;
|
||||
self.verticalScrollView.bounces = NO;
|
||||
self.verticalScrollView.alwaysBounceVertical = YES;
|
||||
self.verticalScrollView.showsVerticalScrollIndicator = YES;
|
||||
self.verticalScrollView.showsHorizontalScrollIndicator = NO;
|
||||
[self addSubview:self.verticalScrollView];
|
||||
|
||||
// 主水平滚动视图 - 占据整个视图,但只处理水平滚动
|
||||
self.horizontalScrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
|
||||
self.horizontalScrollView.delegate = self;
|
||||
self.horizontalScrollView.bounces = NO;
|
||||
self.horizontalScrollView.alwaysBounceHorizontal = YES;
|
||||
self.horizontalScrollView.showsHorizontalScrollIndicator = YES;
|
||||
self.horizontalScrollView.showsVerticalScrollIndicator = NO;
|
||||
[self addSubview:self.horizontalScrollView];
|
||||
|
||||
// 内容滚动视图 - 只显示内容区域(不包括固定行列)
|
||||
CGRect contentFrame = CGRectMake(self.rowHeaderWidth, self.columnHeaderHeight,
|
||||
self.bounds.size.width - self.rowHeaderWidth,
|
||||
self.bounds.size.height - self.columnHeaderHeight);
|
||||
self.contentScrollView = [[UIScrollView alloc] initWithFrame:contentFrame];
|
||||
self.contentScrollView.delegate = self;
|
||||
self.contentScrollView.bounces = NO;
|
||||
self.contentScrollView.alwaysBounceVertical = YES;
|
||||
self.contentScrollView.alwaysBounceHorizontal = YES;
|
||||
self.contentScrollView.showsVerticalScrollIndicator = NO;
|
||||
self.contentScrollView.showsHorizontalScrollIndicator = NO;
|
||||
[self addSubview:self.contentScrollView];
|
||||
|
||||
// 行标题滚动视图 - 支持垂直滚动
|
||||
CGRect rowHeaderFrame = CGRectMake(0, self.columnHeaderHeight, self.rowHeaderWidth, self.bounds.size.height - self.columnHeaderHeight);
|
||||
self.rowHeaderScrollView = [[UIScrollView alloc] initWithFrame:rowHeaderFrame];
|
||||
self.rowHeaderScrollView.delegate = self;
|
||||
self.rowHeaderScrollView.bounces = NO;
|
||||
self.rowHeaderScrollView.alwaysBounceVertical = YES;
|
||||
self.rowHeaderScrollView.showsVerticalScrollIndicator = NO;
|
||||
self.rowHeaderScrollView.showsHorizontalScrollIndicator = NO;
|
||||
[self addSubview:self.rowHeaderScrollView];
|
||||
|
||||
self.borderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.cellWidth, 0)];
|
||||
[self.borderView addRoundedCornersWithRadius:6];
|
||||
self.borderView.layer.borderWidth = 1;
|
||||
self.borderView.layer.borderColor = RGB16(0xF5E9D1).CGColor;
|
||||
self.borderView.hidden = YES;
|
||||
|
||||
}
|
||||
|
||||
- (void)createFixedViews {
|
||||
// 左上角固定区域 - 永远固定在左上角
|
||||
self.cornerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.rowHeaderWidth, self.columnHeaderHeight)];
|
||||
self.cornerView.backgroundColor = [UIColor clearColor];
|
||||
self.cornerView.backgroundColor = RGB16(0x2A2A4E);
|
||||
self.cornerView.userInteractionEnabled = NO; // 禁止交互,让滚动视图可以接收触摸
|
||||
|
||||
UILabel *cornerLabel = [[UILabel alloc] initWithFrame:self.cornerView.bounds];
|
||||
cornerLabel.textAlignment = NSTextAlignmentCenter;
|
||||
cornerLabel.textColor = UIColor.whiteColor;
|
||||
cornerLabel.font = [UIFont boldSystemFontOfSize:14];
|
||||
self.cornerLabel = cornerLabel;
|
||||
[self.cornerView addSubview:cornerLabel];
|
||||
[self addSubview:self.cornerView];
|
||||
|
||||
// 列标题固定区域 - 永远固定在第一行
|
||||
self.columnHeaderView = [[UIView alloc] initWithFrame:CGRectMake(self.rowHeaderWidth, 0, self.bounds.size.width - self.rowHeaderWidth, self.columnHeaderHeight)];
|
||||
self.columnHeaderView.backgroundColor = [UIColor clearColor];
|
||||
self.columnHeaderView.backgroundColor = RGB16(0x2A2A4E);
|
||||
self.columnHeaderView.userInteractionEnabled = NO;
|
||||
[self insertSubview:self.columnHeaderView belowSubview:self.cornerView];
|
||||
|
||||
}
|
||||
- (void)createContentViews {
|
||||
if (self.privilegeTitles.count == 0) {
|
||||
return;
|
||||
}
|
||||
NSArray *columnTitles = self.privilegeTitles;
|
||||
NSInteger columnCount = columnTitles.count - 1; // 减去第一列
|
||||
|
||||
// 计算内容总尺寸
|
||||
CGFloat contentWidth = self.cellWidth * columnCount;
|
||||
CGFloat contentHeight = self.cellHeight * self.rowCount;
|
||||
|
||||
// 设置滚动视图内容大小
|
||||
self.verticalScrollView.contentSize = CGSizeMake(self.bounds.size.width, self.columnHeaderHeight + contentHeight);
|
||||
self.horizontalScrollView.contentSize = CGSizeMake(self.rowHeaderWidth + contentWidth, self.bounds.size.height);
|
||||
self.contentScrollView.contentSize = CGSizeMake(contentWidth, contentHeight);
|
||||
self.rowHeaderScrollView.contentSize = CGSizeMake(self.rowHeaderWidth, contentHeight);
|
||||
self.borderView.height = self.columnHeaderHeight + contentHeight;
|
||||
// 创建内容容器
|
||||
self.contentContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, contentWidth, contentHeight)];
|
||||
[self.contentScrollView addSubview:self.contentContainer];
|
||||
|
||||
// 创建行标题容器
|
||||
self.rowHeaderContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.rowHeaderWidth, contentHeight)];
|
||||
[self.rowHeaderScrollView addSubview:self.rowHeaderContainer];
|
||||
|
||||
// 创建列标题
|
||||
[self createColumnHeaders:columnTitles];
|
||||
|
||||
// 创建行标题
|
||||
[self createRowHeaders];
|
||||
|
||||
// 创建内容单元格
|
||||
[self createContentCells:columnTitles];
|
||||
}
|
||||
|
||||
|
||||
- (void)createColumnHeaders:(NSArray *)columnTitles {
|
||||
// 清除旧内容
|
||||
for (UIView *view in self.columnHeaderView.subviews) {
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
|
||||
CGFloat totalHeaderWidth = self.cellWidth * (columnTitles.count - 1);
|
||||
|
||||
for (int i = 0; i < columnTitles.count - 1; i++) {
|
||||
UIView *headerCell = [[UIView alloc] initWithFrame:CGRectMake(i * self.cellWidth, 0, self.cellWidth, self.columnHeaderHeight)];
|
||||
|
||||
|
||||
UILabel *label = [[UILabel alloc] initWithFrame:headerCell.bounds];
|
||||
label.text = columnTitles[i + 1]; // 跳过第一列
|
||||
label.textAlignment = NSTextAlignmentCenter;
|
||||
label.font = [UIFont boldSystemFontOfSize:12];
|
||||
label.textColor = UIColor.whiteColor;
|
||||
label.numberOfLines = 0;
|
||||
[headerCell addSubview:label];
|
||||
|
||||
[self.columnHeaderView addSubview:headerCell];
|
||||
}
|
||||
|
||||
// 设置列标题容器的内容大小
|
||||
self.columnHeaderView.frame = CGRectMake(self.rowHeaderWidth, 0, totalHeaderWidth, self.columnHeaderHeight);
|
||||
}
|
||||
|
||||
- (void)createRowHeaders {
|
||||
// 清除旧内容
|
||||
for (UIView *view in self.rowHeaderContainer.subviews) {
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
for (int i = 0; i < self.rowHeaders.count; i++) {
|
||||
QXUserNobility *titleData = self.rowHeaders[i];
|
||||
UIView *headerCell = [[UIView alloc] initWithFrame:CGRectMake(0, i * self.cellHeight, self.rowHeaderWidth, self.cellHeight)];
|
||||
// headerCell.layer.borderWidth = 0.5;
|
||||
// headerCell.layer.borderColor = [UIColor lightGrayColor].CGColor;
|
||||
|
||||
UILabel *label = [[UILabel alloc] initWithFrame:headerCell.bounds];
|
||||
label.text = [NSString stringWithFormat:@"%@", titleData.name];
|
||||
label.textAlignment = NSTextAlignmentCenter;
|
||||
label.textColor = UIColor.whiteColor;
|
||||
label.font = [UIFont systemFontOfSize:12];
|
||||
[headerCell addSubview:label];
|
||||
if (i%2==0) {
|
||||
headerCell.backgroundColor = RGB16A(0x323252, 1);
|
||||
}else{
|
||||
headerCell.backgroundColor = RGB16A(0x2A2A4E, 1);
|
||||
}
|
||||
// 高亮当前用户
|
||||
// if (titleData.isCurrentUser) {
|
||||
// headerCell.backgroundColor = [UIColor colorWithRed:0.8 green:0.9 blue:1.0 alpha:1.0];
|
||||
// headerCell.layer.borderWidth = 2;
|
||||
// headerCell.layer.borderColor = [UIColor systemBlueColor].CGColor;
|
||||
// }
|
||||
|
||||
[self.rowHeaderContainer addSubview:headerCell];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)createContentCells:(NSArray *)columnTitles {
|
||||
// // 清除旧内容
|
||||
for (UIView *view in self.contentContainer.subviews) {
|
||||
[view removeFromSuperview];
|
||||
}
|
||||
|
||||
for (int col = 0; col < columnTitles.count - 1; col++) {
|
||||
QXNobilityLevel *model = self.model.nobility_power_list[col+1];
|
||||
for (int row = 0; row < self.rowHeaders.count; row++) {
|
||||
// UIView *cell = [[UIView alloc] initWithFrame:CGRectMake(col * self.cellWidth, row * self.cellHeight, self.cellWidth, self.cellHeight)];
|
||||
// cell.layer.borderWidth = 0.5;
|
||||
// cell.layer.borderColor = [UIColor lightGrayColor].CGColor;
|
||||
//
|
||||
// UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, self.cellWidth - 10, self.cellHeight)];
|
||||
// label.font = [UIFont systemFontOfSize:12];
|
||||
// label.numberOfLines = 0;
|
||||
// label.textColor = UIColor.whiteColor;
|
||||
QXUserNobility *md = model.nobility_list[row];
|
||||
// label.text = md.status.intValue == 1?@"开":@"关";
|
||||
// [cell addSubview:label];;
|
||||
// [self.contentContainer addSubview:cell];
|
||||
|
||||
QXNobilityContentColView *colView = [[QXNobilityContentColView alloc] initWithFrame:CGRectMake(col * self.cellWidth, row * self.cellHeight, self.cellWidth, self.cellHeight)];
|
||||
colView.model = md;
|
||||
if (row%2==0) {
|
||||
colView.backgroundColor = RGB16A(0x323252, 1);
|
||||
}else{
|
||||
colView.backgroundColor = RGB16A(0x2A2A4E, 1);
|
||||
}
|
||||
[self.contentContainer addSubview:colView];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - UIScrollViewDelegate
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
|
||||
if (self.isSyncingScroll) return;
|
||||
|
||||
self.isSyncingScroll = YES;
|
||||
|
||||
if (scrollView == self.verticalScrollView) {
|
||||
// 垂直滚动时,同步内容区域和行标题的垂直滚动
|
||||
CGFloat offsetY = scrollView.contentOffset.y;
|
||||
self.contentScrollView.contentOffset = CGPointMake(self.contentScrollView.contentOffset.x, offsetY);
|
||||
self.rowHeaderScrollView.contentOffset = CGPointMake(0, offsetY);
|
||||
|
||||
} else if (scrollView == self.horizontalScrollView) {
|
||||
// 水平滚动时,同步内容区域的水平滚动
|
||||
CGFloat offsetX = scrollView.contentOffset.x;
|
||||
self.contentScrollView.contentOffset = CGPointMake(offsetX, self.contentScrollView.contentOffset.y);
|
||||
|
||||
} else if (scrollView == self.contentScrollView) {
|
||||
// 内容区域滚动时,同步主滚动视图
|
||||
CGFloat offsetX = scrollView.contentOffset.x;
|
||||
CGFloat offsetY = scrollView.contentOffset.y;
|
||||
|
||||
self.verticalScrollView.contentOffset = CGPointMake(self.verticalScrollView.contentOffset.x, offsetY);
|
||||
self.horizontalScrollView.contentOffset = CGPointMake(offsetX, self.horizontalScrollView.contentOffset.y);
|
||||
self.rowHeaderScrollView.contentOffset = CGPointMake(0, offsetY);
|
||||
|
||||
} else if (scrollView == self.rowHeaderScrollView) {
|
||||
// 行标题滚动时,同步垂直滚动
|
||||
CGFloat offsetY = scrollView.contentOffset.y;
|
||||
self.verticalScrollView.contentOffset = CGPointMake(self.verticalScrollView.contentOffset.x, offsetY);
|
||||
self.contentScrollView.contentOffset = CGPointMake(self.contentScrollView.contentOffset.x, offsetY);
|
||||
}
|
||||
|
||||
// 更新固定视图的位置
|
||||
[self updateFixedViewsPosition];
|
||||
|
||||
self.isSyncingScroll = NO;
|
||||
}
|
||||
|
||||
- (void)updateFixedViewsPosition {
|
||||
CGFloat offsetX = self.horizontalScrollView.contentOffset.x;
|
||||
CGFloat offsetY = self.verticalScrollView.contentOffset.y;
|
||||
|
||||
// 固定视图的位置应该始终在可视区域内
|
||||
// 左上角:始终在 (0, 0)
|
||||
self.cornerView.frame = CGRectMake(0, 0, self.rowHeaderWidth, self.columnHeaderHeight);
|
||||
|
||||
// 列标题:水平跟随滚动,垂直固定在顶部
|
||||
self.columnHeaderView.frame = CGRectMake(self.rowHeaderWidth - offsetX, 0, self.columnHeaderView.frame.size.width, self.columnHeaderHeight);
|
||||
|
||||
// 行标题滚动视图:水平固定在左侧,垂直位置由自己的contentOffset控制
|
||||
self.rowHeaderScrollView.frame = CGRectMake(0, self.columnHeaderHeight, self.rowHeaderWidth, self.bounds.size.height - self.columnHeaderHeight);
|
||||
}
|
||||
|
||||
-(void)setModel:(QXNobilityModel *)model{
|
||||
_model = model;
|
||||
[self.privilegeTitles removeAllObjects];
|
||||
[self.rowHeaders removeAllObjects];
|
||||
for (int i = 0; i < model.nobility_power_list.count;i++ ) {
|
||||
QXNobilityLevel*md = model.nobility_power_list[i];
|
||||
[self.privilegeTitles addObject:md.name];
|
||||
self.rowCount = md.nobility_list.count;
|
||||
if (i == 0) {
|
||||
self.cornerLabel.text = md.name;
|
||||
[self.rowHeaders addObjectsFromArray:md.nobility_list];
|
||||
}
|
||||
|
||||
}
|
||||
self.currentIndex = 3;
|
||||
}
|
||||
- (void)reloadData {
|
||||
[self createContentViews];
|
||||
[self scrollToCurrentUser];
|
||||
}
|
||||
|
||||
- (void)scrollToCurrentUser {
|
||||
if (self.currentIndex == -1) {
|
||||
return;
|
||||
}
|
||||
// self.borderView.hidden = NO;
|
||||
// self.borderView.x = ((self.width/4)*(self.currentIndex));
|
||||
// [self.horizontalScrollView addSubview:self.borderView];
|
||||
// [self.horizontalScrollView bringSubviewToFront:self.borderView];
|
||||
if (self.currentIndex<3) {
|
||||
return;
|
||||
}
|
||||
[self.horizontalScrollView setContentOffset:CGPointMake(((self.width/4)*(self.currentIndex-2)),0 ) animated:YES];
|
||||
}
|
||||
-(NSMutableArray *)privilegeTitles{
|
||||
if (!_privilegeTitles) {
|
||||
_privilegeTitles = [NSMutableArray array];
|
||||
}
|
||||
return _privilegeTitles;
|
||||
}
|
||||
-(NSMutableArray *)rowHeaders{
|
||||
if (!_rowHeaders) {
|
||||
_rowHeaders = [NSMutableArray array];
|
||||
}
|
||||
return _rowHeaders;
|
||||
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@implementation QXNobilityContentColView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setModel:(QXUserNobility *)model{
|
||||
if (model.type.intValue == 1) {
|
||||
if (model.status.intValue == 1) {
|
||||
self.imageView.image = [UIImage imageNamed:@"nobility_power_on"];
|
||||
}else{
|
||||
self.imageView.image = [UIImage imageNamed:@"nobility_power_off"];
|
||||
}
|
||||
}else{
|
||||
if ([model.nick_name_color_name isExist]) {
|
||||
self.titleLabel.textColor = [UIColor colorWithHexString:model.nick_name_color];
|
||||
self.titleLabel.text = model.nick_name_color_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.colorView = [[UIView alloc] init];
|
||||
[self.colorView addRoundedCornersWithRadius:11];
|
||||
[self addSubview:self.colorView];
|
||||
[self.colorView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self);
|
||||
make.width.height.mas_equalTo(22);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = RGB16(0xffffff);
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
self.imageView = [[UIImageView alloc] init];
|
||||
self.imageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.imageView];
|
||||
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.centerY.equalTo(self);
|
||||
make.width.height.mas_equalTo(22);
|
||||
}];
|
||||
|
||||
}
|
||||
@end
|
||||
19
QXLive/Mine(音域)/View/爵位/QXNobilityDetailCell.h
Normal file
19
QXLive/Mine(音域)/View/爵位/QXNobilityDetailCell.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXNobilityDetailCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXNobilityListModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXNobilityDetailCell : UICollectionViewCell
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *detailLabel;
|
||||
@property (nonatomic,strong)QXNobilityPowerList *model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
22
QXLive/Mine(音域)/View/爵位/QXNobilityDetailCell.m
Normal file
22
QXLive/Mine(音域)/View/爵位/QXNobilityDetailCell.m
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// QXNobilityDetailCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/8.
|
||||
//
|
||||
|
||||
#import "QXNobilityDetailCell.h"
|
||||
|
||||
@implementation QXNobilityDetailCell
|
||||
-(void)setModel:(QXNobilityPowerList *)model{
|
||||
_model = model;
|
||||
[self.imageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
|
||||
self.titleLabel.text = model.name;
|
||||
self.detailLabel.text = model.content;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
@end
|
||||
81
QXLive/Mine(音域)/View/爵位/QXNobilityDetailCell.xib
Normal file
81
QXLive/Mine(音域)/View/爵位/QXNobilityDetailCell.xib
Normal file
@@ -0,0 +1,81 @@
|
||||
<?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="QXNobilityDetailCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="234" height="264"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="234" height="264"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xLT-Xg-Faz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="234" height="264"/>
|
||||
<color key="backgroundColor" red="0.16470588235294117" green="0.16078431372549018" blue="0.14509803921568626" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="4"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="v8w-N9-of1">
|
||||
<rect key="frame" x="32" y="38" width="170" height="170"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="v8w-N9-of1" secondAttribute="height" multiplier="1:1" id="xE8-2U-Q4D"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o3H-L7-zGq">
|
||||
<rect key="frame" x="7" y="216" width="220" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="tF6-85-THZ"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.85490196078431369" green="0.74117647058823533" blue="0.60392156862745094" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4BP-5u-QY4">
|
||||
<rect key="frame" x="7" y="238" width="220" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="gOE-Qf-Pmu"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.46666666666666667" green="0.46666666666666667" blue="0.45882352941176469" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</view>
|
||||
<viewLayoutGuide key="safeArea" id="SEy-5g-ep8"/>
|
||||
<constraints>
|
||||
<constraint firstItem="4BP-5u-QY4" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="7" id="6Cn-Ir-Kpu"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4BP-5u-QY4" secondAttribute="trailing" constant="7" id="A9u-ce-WWY"/>
|
||||
<constraint firstItem="o3H-L7-zGq" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="7" id="CLo-rE-ybM"/>
|
||||
<constraint firstAttribute="trailing" secondItem="o3H-L7-zGq" secondAttribute="trailing" constant="7" id="CiZ-7I-Tt0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="v8w-N9-of1" secondAttribute="trailing" constant="32" id="Dm3-kU-uHK"/>
|
||||
<constraint firstItem="o3H-L7-zGq" firstAttribute="top" secondItem="v8w-N9-of1" secondAttribute="bottom" constant="8" id="Fse-jn-eg5"/>
|
||||
<constraint firstAttribute="trailing" secondItem="xLT-Xg-Faz" secondAttribute="trailing" id="I7V-P0-Wce"/>
|
||||
<constraint firstItem="xLT-Xg-Faz" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="R9b-Pk-7kv"/>
|
||||
<constraint firstItem="v8w-N9-of1" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="32" id="Z12-gU-Cot"/>
|
||||
<constraint firstAttribute="bottom" secondItem="4BP-5u-QY4" secondAttribute="bottom" constant="9" id="bCf-Nt-Q5f"/>
|
||||
<constraint firstItem="xLT-Xg-Faz" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="gKP-tC-6Lb"/>
|
||||
<constraint firstAttribute="bottom" secondItem="xLT-Xg-Faz" secondAttribute="bottom" id="tP6-br-JEa"/>
|
||||
<constraint firstItem="4BP-5u-QY4" firstAttribute="top" secondItem="o3H-L7-zGq" secondAttribute="bottom" constant="2" id="vav-ld-2v5"/>
|
||||
</constraints>
|
||||
<size key="customSize" width="234" height="264"/>
|
||||
<connections>
|
||||
<outlet property="detailLabel" destination="4BP-5u-QY4" id="pNH-JS-TJQ"/>
|
||||
<outlet property="imageView" destination="v8w-N9-of1" id="sQP-eY-MPi"/>
|
||||
<outlet property="titleLabel" destination="o3H-L7-zGq" id="AbG-Si-q2W"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="279.38931297709922" y="95.070422535211279"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
20
QXLive/Mine(音域)/View/爵位/QXNobilityDetailTopCell.h
Normal file
20
QXLive/Mine(音域)/View/爵位/QXNobilityDetailTopCell.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// QXNobilityDetailTopCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/8.
|
||||
//
|
||||
|
||||
#import "GKCycleScrollViewCell.h"
|
||||
#import "QXNobilityListModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXNobilityDetailTopCell : GKCycleScrollViewCell
|
||||
@property (nonatomic,strong)QXNobilityListModel *model;
|
||||
|
||||
@property (nonatomic,assign)NSInteger index;
|
||||
@property (nonatomic,assign)NSInteger myIndex;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
66
QXLive/Mine(音域)/View/爵位/QXNobilityDetailTopCell.m
Normal file
66
QXLive/Mine(音域)/View/爵位/QXNobilityDetailTopCell.m
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// QXNobilityDetailTopCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/8.
|
||||
//
|
||||
|
||||
#import "QXNobilityDetailTopCell.h"
|
||||
#import "UIImage+QX.h"
|
||||
|
||||
@interface QXNobilityDetailTopCell()
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIImageView *currentNobilityImageView;
|
||||
@end
|
||||
@implementation QXNobilityDetailTopCell
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubViews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setIndex:(NSInteger)index{
|
||||
_index = index;
|
||||
}
|
||||
-(void)setMyIndex:(NSInteger)myIndex{
|
||||
_myIndex = myIndex;
|
||||
}
|
||||
-(void)setModel:(QXNobilityListModel *)model{
|
||||
_model = model;
|
||||
if (self.myIndex<=self.index) {
|
||||
[self.currentNobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
|
||||
}else{
|
||||
[self.currentNobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.image] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
||||
image = [UIImage qx_convertImageToGrayWithCoreImage:image];
|
||||
self.currentNobilityImageView.image = image;
|
||||
}];
|
||||
}
|
||||
self.titleLabel.text = model.name;
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.currentNobilityImageView = [[UIImageView alloc] init];
|
||||
self.currentNobilityImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.currentNobilityImageView addRoundedCornersWithRadius:7];
|
||||
[self addSubview:self.currentNobilityImageView];
|
||||
[self.currentNobilityImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(self);
|
||||
make.width.height.mas_equalTo(220);
|
||||
make.centerX.equalTo(self);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = RGB16(0xF4C07C);
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.titleLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:34];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.top.equalTo(self);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
25
QXLive/Mine(音域)/View/爵位/QXNobilityHeaderView.h
Normal file
25
QXLive/Mine(音域)/View/爵位/QXNobilityHeaderView.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// QXNobilityHeaderView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXNobilityModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol QXNobilityHeaderViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
/// 去开通
|
||||
-(void)didOpenNobility;
|
||||
/// 去续费
|
||||
-(void)didRenewNobility;
|
||||
|
||||
@end
|
||||
@interface QXNobilityHeaderView : UIView
|
||||
@property (nonatomic,strong)QXNobilityModel *model;
|
||||
@property (nonatomic,weak)id<QXNobilityHeaderViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
145
QXLive/Mine(音域)/View/爵位/QXNobilityHeaderView.m
Normal file
145
QXLive/Mine(音域)/View/爵位/QXNobilityHeaderView.m
Normal file
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// QXNobilityHeaderView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/7.
|
||||
//
|
||||
|
||||
#import "QXNobilityHeaderView.h"
|
||||
#import "QXSeatHeaderView.h"
|
||||
@interface QXNobilityHeaderView()
|
||||
@property (nonatomic,strong)QXSeatHeaderView *userAvatarView;
|
||||
@property (nonatomic,strong)UILabel *userNameLabel;
|
||||
|
||||
|
||||
/// 当前爵位
|
||||
@property (nonatomic,strong)UIView *currentNobilityBgView;
|
||||
@property (nonatomic,strong)UIImageView *currentNobilityBgImageView;
|
||||
|
||||
/// 有爵位
|
||||
@property (nonatomic,strong)UILabel *currentNobilityLabel;
|
||||
@property (nonatomic,strong)UIButton *buyBtn;
|
||||
/// 无爵位
|
||||
@property (nonatomic,strong)UIButton *openBtn;
|
||||
|
||||
@property (nonatomic,strong)UILabel *currentNobilityTimeLabel;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *currenNobilityImageView;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *compareImageView;
|
||||
@end
|
||||
@implementation QXNobilityHeaderView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
self.height = self.compareImageView.bottom+12;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.userAvatarView = [[QXSeatHeaderView alloc] initWithFrame:CGRectMake(16, 0, 40, 40)];
|
||||
[self.userAvatarView setHeadIcon:QXGlobal.shareGlobal.loginModel.avatar dress:@""];
|
||||
[self addSubview:self.userAvatarView];
|
||||
|
||||
self.userNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.userAvatarView.right+10, self.userAvatarView.top, 300, 40)];
|
||||
self.userNameLabel.text = [NSString stringWithFormat:@"%@的爵位",QXGlobal.shareGlobal.loginModel.nickname];
|
||||
self.userNameLabel.textColor = RGB16(0xF5E9D1);
|
||||
self.userNameLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:self.userNameLabel];
|
||||
|
||||
self.currentNobilityBgView = [[UIView alloc] initWithFrame:CGRectMake(16, self.userAvatarView.bottom+10, SCREEN_WIDTH-16*2, ScaleWidth(91))];
|
||||
[self addSubview:self.currentNobilityBgView];
|
||||
|
||||
self.currentNobilityBgImageView = [[UIImageView alloc] initWithFrame:self.currentNobilityBgView.bounds];
|
||||
self.currentNobilityBgImageView.image = [UIImage imageNamed:@"nobility_current_bg"];
|
||||
[self.currentNobilityBgView addSubview:self.currentNobilityBgImageView];
|
||||
|
||||
self.currentNobilityLabel = [[UILabel alloc] init];
|
||||
self.currentNobilityLabel.textColor = RGB16(0xA292FF);
|
||||
self.currentNobilityLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:34];
|
||||
[self.currentNobilityBgView addSubview:self.currentNobilityLabel];
|
||||
[self.currentNobilityLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(13);
|
||||
make.top.mas_equalTo(6);
|
||||
}];
|
||||
|
||||
self.buyBtn = [[UIButton alloc] init];
|
||||
[self.buyBtn setImage:[UIImage imageNamed:@"nobility_buy"] forState:(UIControlStateNormal)];
|
||||
[self.buyBtn addTarget:self action:@selector(buyAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.currentNobilityBgView addSubview:self.buyBtn];
|
||||
[self.buyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.currentNobilityLabel.mas_right).offset(12);
|
||||
make.width.mas_equalTo(ScaleWidth(60));
|
||||
make.height.mas_equalTo(ScaleWidth(22));
|
||||
make.centerY.equalTo(self.currentNobilityLabel);
|
||||
}];
|
||||
|
||||
self.currentNobilityTimeLabel = [[UILabel alloc] init];
|
||||
self.currentNobilityTimeLabel.textColor = RGB16(0xF5E9D1);
|
||||
self.currentNobilityTimeLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.currentNobilityBgView addSubview:self.currentNobilityTimeLabel];
|
||||
[self.currentNobilityTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.currentNobilityLabel);
|
||||
make.bottom.equalTo(self.currentNobilityBgView).offset(-12);
|
||||
}];
|
||||
|
||||
self.openBtn = [[UIButton alloc] init];
|
||||
[self.openBtn setImage:[UIImage imageNamed:@"nobility_open"] forState:(UIControlStateNormal)];
|
||||
[self.openBtn addTarget:self action:@selector(openAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.currentNobilityBgView addSubview:self.openBtn];
|
||||
[self.openBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.currentNobilityBgView).offset(12);
|
||||
make.width.mas_equalTo(ScaleWidth(113));
|
||||
make.height.mas_equalTo(ScaleWidth(36));
|
||||
make.top.mas_equalTo(17);
|
||||
}];
|
||||
self.currenNobilityImageView = [[UIImageView alloc] init];
|
||||
[self addSubview:self.currenNobilityImageView];
|
||||
[self.currenNobilityImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-28);
|
||||
make.height.width.mas_equalTo(ScaleWidth(104));
|
||||
make.bottom.mas_equalTo(-34);
|
||||
}];
|
||||
|
||||
self.compareImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nobility_compare_top"]];
|
||||
self.compareImageView.frame = CGRectMake(41, self.currentNobilityBgView.bottom+13, SCREEN_WIDTH-41*2, ScaleWidth(54));
|
||||
self.compareImageView.contentMode = UIViewContentModeScaleToFill;
|
||||
[self addSubview:self.compareImageView];
|
||||
|
||||
// self.currentNobilityLabel.text = @"骑士";
|
||||
// self.currentNobilityTimeLabel.text = @"有效期剩余:15天22小时";
|
||||
[self setHaveNobility:NO];
|
||||
}
|
||||
|
||||
-(void)setModel:(QXNobilityModel *)model{
|
||||
_model = model;
|
||||
[self.userAvatarView setHeadIcon:model.user_info.avatar dress:@""];
|
||||
self.userNameLabel.text = [NSString stringWithFormat:@"%@的爵位",model.user_info.nickname];
|
||||
if (model.nobility_info.status.intValue == 0) {
|
||||
[self setHaveNobility:NO];
|
||||
}else{
|
||||
[self setHaveNobility:YES];
|
||||
}
|
||||
}
|
||||
-(void)setHaveNobility:(BOOL)have{
|
||||
self.openBtn.hidden = have;
|
||||
self.buyBtn.hidden = !have;
|
||||
self.currentNobilityLabel.hidden = !have;
|
||||
self.currentNobilityLabel.text = self.model.nobility_info.name;
|
||||
self.currentNobilityTimeLabel.text = have?[NSString stringWithFormat:@"截止时间:%@",self.model.nobility_info.end_time]:@"您尚未开通任何爵位";
|
||||
}
|
||||
|
||||
-(void)openAction{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didOpenNobility)]) {
|
||||
[self.delegate didOpenNobility];
|
||||
}
|
||||
}
|
||||
-(void)buyAction{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(didRenewNobility)]) {
|
||||
[self.delegate didRenewNobility];
|
||||
}
|
||||
}
|
||||
@end
|
||||
16
QXLive/Mine(音域)/View/爵位/QXNobilityPriceView.h
Normal file
16
QXLive/Mine(音域)/View/爵位/QXNobilityPriceView.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXNobilityPriceView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXNobilityGetPriceModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXNobilityPriceView : UIView
|
||||
@property (nonatomic,strong)QXNobilityGetPriceModel *model;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
101
QXLive/Mine(音域)/View/爵位/QXNobilityPriceView.m
Normal file
101
QXLive/Mine(音域)/View/爵位/QXNobilityPriceView.m
Normal file
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// QXNobilityPriceView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/11/8.
|
||||
//
|
||||
|
||||
#import "QXNobilityPriceView.h"
|
||||
@interface QXNobilityPriceView()
|
||||
@property (nonatomic,strong)UIImageView *bgImageView;
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *timeLabel;
|
||||
@property (nonatomic,strong)UILabel *priceLabel;
|
||||
@property (nonatomic,strong)UILabel *originalPriceLabel;
|
||||
|
||||
@property (nonatomic,strong)UIImageView *currentNobilityImageView;
|
||||
@end
|
||||
@implementation QXNobilityPriceView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.bgImageView = [[UIImageView alloc] init];
|
||||
self.bgImageView.backgroundColor = RGB16(0xFAF9D7);
|
||||
[self.bgImageView addRoundedCornersWithRadius:8];
|
||||
[self addSubview:self.bgImageView];;
|
||||
[self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.right.mas_equalTo(-16);
|
||||
make.top.mas_equalTo(34);
|
||||
make.bottom.equalTo(self);
|
||||
}];
|
||||
|
||||
self.currentNobilityImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@""]];
|
||||
[self addSubview:self.currentNobilityImageView];
|
||||
[self.currentNobilityImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self);
|
||||
make.right.equalTo(self.bgImageView.mas_right).offset(-34);
|
||||
make.height.width.mas_equalTo(104);
|
||||
}];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.textColor = RGB16(0x333333);
|
||||
self.titleLabel.font = [UIFont fontWithName:@"YouSheBiaoTiHei" size:34];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.bgImageView).offset(22);
|
||||
make.top.equalTo(self.bgImageView).offset(18);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
self.timeLabel = [[UILabel alloc] init];
|
||||
self.timeLabel.textColor = RGB16A(0x000000, 0.65);
|
||||
self.timeLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:self.timeLabel];
|
||||
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel);
|
||||
make.top.equalTo(self.titleLabel.mas_bottom);
|
||||
}];
|
||||
|
||||
|
||||
self.originalPriceLabel = [[UILabel alloc] init];
|
||||
self.originalPriceLabel.textColor = RGB16(0x999999);
|
||||
self.originalPriceLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self addSubview:self.originalPriceLabel];
|
||||
[self.originalPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.height.mas_equalTo(20);
|
||||
make.bottom.equalTo(self.bgImageView.mas_bottom);
|
||||
}];
|
||||
|
||||
self.priceLabel = [[UILabel alloc] init];
|
||||
self.priceLabel.textColor = RGB16(0xFF2727);
|
||||
self.priceLabel.font = [UIFont systemFontOfSize:34];
|
||||
[self addSubview:self.priceLabel];
|
||||
[self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self);
|
||||
make.height.mas_equalTo(32);
|
||||
make.bottom.equalTo(self.originalPriceLabel.mas_top);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)setModel:(QXNobilityGetPriceModel *)model{
|
||||
_model = model;
|
||||
[self.currentNobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]];
|
||||
self.titleLabel.text = model.nobility_name;
|
||||
self.timeLabel.text = [NSString stringWithFormat:@"有效期:%@天",model.day];
|
||||
NSString *price = [NSString stringWithFormat:@"¥%@",model.price];
|
||||
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:price];
|
||||
[attr yy_setFont:[UIFont systemFontOfSize:18] range:NSMakeRange(0, 1)];
|
||||
self.priceLabel.attributedText = attr;
|
||||
NSAttributedString *at = [[NSString stringWithFormat:@"¥%@",model.pay_price] deleteLineWithTextColor:RGB16(0x999999) lineColor:RGB16(0x999999)];
|
||||
self.originalPriceLabel.attributedText = at;
|
||||
}
|
||||
@end
|
||||
@@ -153,7 +153,7 @@
|
||||
self.btnSwitch = [[UIButton alloc] init];
|
||||
[self.btnSwitch setImage:[UIImage imageNamed:@"home_switch_off"] forState:(UIControlStateNormal)];
|
||||
[self.btnSwitch setImage:[UIImage imageNamed:@"home_switch_on"] forState:(UIControlStateSelected)];
|
||||
[self.btnSwitch addTarget:self action:@selector(btnSwitchAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
// [self.btnSwitch addTarget:self action:@selector(btnSwitchAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.contentView addSubview:self.btnSwitch];
|
||||
[self.btnSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-16);
|
||||
@@ -198,9 +198,9 @@
|
||||
_needLine = needLine;
|
||||
self.lineView.hidden = !needLine;
|
||||
}
|
||||
- (void)btnSwitchAction:(UIButton *)sender {
|
||||
sender.selected = !sender.selected;
|
||||
}
|
||||
//- (void)btnSwitchAction:(UIButton *)sender {
|
||||
//// sender.selected = !sender.selected;
|
||||
//}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
|
||||
Reference in New Issue
Block a user