增加换肤功能

This commit is contained in:
启星
2025-08-14 10:07:49 +08:00
parent f6964c1e89
commit 4f9318d98e
8789 changed files with 978530 additions and 2 deletions

View File

@@ -0,0 +1,143 @@
//
// GKCycleScrollView.h
// GKCycleScrollViewDemo
//
// Created by QuintGao on 2019/9/15.
// Copyright © 2019 QuintGao. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GKCycleScrollViewCell.h"
// 滚动方向
typedef NS_ENUM(NSUInteger, GKCycleScrollViewScrollDirection) {
GKCycleScrollViewScrollDirectionHorizontal = 0, // 横向
GKCycleScrollViewScrollDirectionVertical = 1 // 纵向
};
@class GKCycleScrollView;
/// 数据源代理
@protocol GKCycleScrollViewDataSource <NSObject>
/// 返回cell个数
/// @param cycleScrollView cycleScrollView description
- (NSInteger)numberOfCellsInCycleScrollView:(GKCycleScrollView *)cycleScrollView;
/// 返回继承自GKCycleScrollViewCell的类
/// @param cycleScrollView cycleScrollView description
/// @param index 索引
- (__kindof GKCycleScrollViewCell *)cycleScrollView:(GKCycleScrollView *)cycleScrollView cellForViewAtIndex:(NSInteger)index;
@end
@protocol GKCycleScrollViewDelegate <NSObject>
@optional
/// 返回自定义cell尺寸
/// @param cycleScrollView cycleScrollView description
- (CGSize)sizeForCellInCycleScrollView:(GKCycleScrollView *)cycleScrollView;
// cell滑动时调用
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didScrollCellToIndex:(NSInteger)index;
// cell点击时调用
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didSelectCellAtIndex:(NSInteger)index;
/// scrollView滚动中的回调
/// @param cycleScrollView cycleScrollView对象
/// @param fromIndex 正在滚动中相对位置处于左边或上边的index根据direction区分
/// @param toIndex 正在滚动中相对位置处于右边或下边的index根据direction区分
/// @param ratio 从左到右或从上到下计算的百分比根据direction区分
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView scrollingFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex ratio:(CGFloat)ratio;
#pragma mark - UIScrollViewDelegate 相关
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView willBeginDragging:(UIScrollView *)scrollView;
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didScroll:(UIScrollView *)scrollView;
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didEndDecelerating:(UIScrollView *)scrollView;
- (void)cycleScrollView:(GKCycleScrollView *)cycleScrollView didEndScrollingAnimation:(UIScrollView *)scrollView;
@end
@interface GKCycleScrollView : UIView
// 数据源
@property (nonatomic, weak) id<GKCycleScrollViewDataSource> dataSource;
// 代理
@property (nonatomic, weak) id<GKCycleScrollViewDelegate> delegate;
// 滚动方向,默认为横向
@property (nonatomic, assign) GKCycleScrollViewScrollDirection direction;
// 滚动视图
@property (nonatomic, strong, readonly) UIScrollView *scrollView;
// 默认为nil需外部创建并传入
@property (nonatomic, weak) UIPageControl *pageControl;
// 当前展示的cell
@property (nonatomic, strong, readonly) GKCycleScrollViewCell *currentCell;
// 当前显示的页码
@property (nonatomic, assign, readonly) NSInteger currentSelectIndex;
// 默认选中的页码默认0
@property (nonatomic, assign) NSInteger defaultSelectIndex;
// 是否自动滚动默认YES
@property (nonatomic, assign) BOOL isAutoScroll;
// 是否无限循环默认YES
@property (nonatomic, assign) BOOL isInfiniteLoop;
// 是否改变透明度默认YES
@property (nonatomic, assign) BOOL isChangeAlpha;
// 非当前页cell的最小透明度默认1.0f
@property (nonatomic, assign) CGFloat minimumCellAlpha;
// 左右间距默认0
@property (nonatomic, assign) CGFloat leftRightMargin;
// 上下间距默认0
@property (nonatomic, assign) CGFloat topBottomMargin;
// 自动滚动时间间隔默认3s
@property (nonatomic, assign) CGFloat autoScrollTime;
/**
刷新数据,必须调用此方法
*/
- (void)reloadData;
/**
获取可重复使用的cell
@return cell
*/
- (GKCycleScrollViewCell *)dequeueReusableCell;
/**
滑动到指定cell
@param index 指定cell的索引
@param animated 是否动画
*/
- (void)scrollToCellAtIndex:(NSInteger)index animated:(BOOL)animated;
/**
调整当前显示的cell的位置防止出现滚动时卡住一半
*/
- (void)adjustCurrentCell;
/**
开启定时器
*/
- (void)startTimer;
/**
关闭定时器
*/
- (void)stopTimer;
@end

View File

@@ -0,0 +1,863 @@
//
// GKCycleScrollView.m
// GKCycleScrollViewDemo
//
// Created by QuintGao on 2019/9/15.
// Copyright © 2019 QuintGao. All rights reserved.
//
#import "GKCycleScrollView.h"
@interface GKCycleScrollView ()<UIScrollViewDelegate>
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) GKCycleScrollViewCell *currentCell;
@property (nonatomic, assign) NSInteger currentSelectIndex;
//
@property (nonatomic, assign) NSInteger realCount;
//
@property (nonatomic, assign) NSInteger showCount;
//
@property (nonatomic, weak) NSTimer *timer;
@property (nonatomic, assign) NSInteger timerIndex;
// cell
@property (nonatomic, assign) CGSize cellSize;
@property (nonatomic, strong) NSMutableArray *visibleCells;
@property (nonatomic, strong) NSMutableArray *reusableCells;
@property (nonatomic, assign) NSRange visibleRange;
// xib
@property (nonatomic, assign) CGSize originSize;
@end
@implementation GKCycleScrollView
#pragma mark - Life Cycle
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initialization];
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder {
if (self = [super initWithCoder:aDecoder]) {
[self initialization];
}
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
if (CGSizeEqualToSize(self.originSize, CGSizeZero)) return;
[self updateScrollViewAndCellSize];
}
// NSTimer
- (void)willMoveToSuperview:(UIView *)newSuperview {
if (!newSuperview) {
[self stopTimer];
}
}
- (void)dealloc {
[self stopTimer];
self.scrollView.delegate = nil;
}
// cellUIScrollView
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
if ([self pointInside:point withEvent:event]) {
// cell
for (UIView *cell in self.scrollView.subviews) {
// cellframe
CGRect convertFrame = CGRectZero;
convertFrame.size = cell.frame.size;
if (self.direction == GKCycleScrollViewScrollDirectionHorizontal) {
convertFrame.origin.x = cell.frame.origin.x + self.scrollView.frame.origin.x - self.scrollView.contentOffset.x;
convertFrame.origin.y = self.scrollView.frame.origin.y + cell.frame.origin.y;
}else {
convertFrame.origin.x = self.scrollView.frame.origin.x + cell.frame.origin.x;
convertFrame.origin.y = cell.frame.origin.y + self.scrollView.frame.origin.y - self.scrollView.contentOffset.y;
}
// cell
if (CGRectContainsPoint(convertFrame, point)) {
// cellbug
UIView *view = [super hitTest:point withEvent:event];
if (view == self || view == cell || view == self.scrollView) return cell;
return view;
}
}
// UIScrollView
CGPoint newPoint = CGPointZero;
newPoint.x = point.x - self.scrollView.frame.origin.x + self.scrollView.contentOffset.x;
newPoint.y = point.y - self.scrollView.frame.origin.y + self.scrollView.contentOffset.y;
if ([self.scrollView pointInside:newPoint withEvent:event]) {
return [self.scrollView hitTest:newPoint withEvent:event];
}
//
return [super hitTest:point withEvent:event];
}
return nil;
}
#pragma mark - Public Methods
- (void)reloadData {
// cell
[self.scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
//
[self stopTimer];
//
if (self.dataSource && [self.dataSource respondsToSelector:@selector(numberOfCellsInCycleScrollView:)]) {
//
self.realCount = [self.dataSource numberOfCellsInCycleScrollView:self];
//
if (self.isInfiniteLoop) {
self.showCount = self.realCount == 1 ? 1 : self.realCount * 3;
}else {
self.showCount = self.realCount;
}
// 0return
if (self.showCount == 0) return;
if (self.pageControl && [self.pageControl respondsToSelector:@selector(setNumberOfPages:)]) {
[self.pageControl setNumberOfPages:self.realCount];
}
}
//
[self.visibleCells removeAllObjects];
[self.reusableCells removeAllObjects];
self.visibleRange = NSMakeRange(0, 0);
//cell1defaultSelectIndex
if (self.defaultSelectIndex >= self.realCount) {
self.defaultSelectIndex = 0;
}
if (self.realCount == 1) {
self.timerIndex = 0;
}
for (NSInteger i = 0; i < self.showCount; i++){
[self.visibleCells addObject:[NSNull null]];
}
__weak __typeof(self) weakSelf = self;
[self refreshSizeCompletion:^{
[weakSelf initialScrollViewAndCellSize];
}];
}
- (void)refreshSizeCompletion:(void(^)(void))completion {
if (self.bounds.size.width == 0 || self.bounds.size.height == 0) {
[self layoutIfNeeded];
// 使Masonryviewbug
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.0f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.bounds.size.width == 0 || self.bounds.size.height == 0) {
[self refreshSizeCompletion:completion];
}else {
!completion ? : completion();
}
});
}else {
!completion ? : completion();
}
}
- (GKCycleScrollViewCell *)dequeueReusableCell{
GKCycleScrollViewCell *cell = self.reusableCells.lastObject;
if (cell) {
[self.reusableCells removeLastObject];
}
return cell;
}
- (void)scrollToCellAtIndex:(NSInteger)index animated:(BOOL)animated {
if (index < self.realCount) {
[self stopTimer];
if (self.isInfiniteLoop) {
self.timerIndex = self.realCount + index;
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(startTimer) object:nil];
[self performSelector:@selector(startTimer) withObject:nil afterDelay:0.5];
} else {
self.timerIndex = index;
}
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal:
[self.scrollView setContentOffset:CGPointMake(self.cellSize.width * self.timerIndex, 0) animated:animated];
break;
case GKCycleScrollViewScrollDirectionVertical:
[self.scrollView setContentOffset:CGPointMake(0, self.cellSize.height * self.timerIndex) animated:animated];
break;
default:
break;
}
[self setupCellsWithContentOffset:self.scrollView.contentOffset];
[self updateVisibleCellAppearance];
}
}
- (void)adjustCurrentCell {
if (self.isAutoScroll && self.realCount > 0) {
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal: {
self.scrollView.contentOffset = CGPointMake(self.cellSize.width * self.timerIndex, 0);
}
break;
case GKCycleScrollViewScrollDirectionVertical: {
self.scrollView.contentOffset = CGPointMake(0, self.cellSize.height * self.timerIndex);
}
break;
default:
break;
}
}
}
- (void)startTimer {
if (self.realCount > 1 && self.isAutoScroll) {
[self stopTimer];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:self.autoScrollTime target:self selector:@selector(timerUpdate) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
self.timer = timer;
}
}
- (void)stopTimer {
if (self.timer) {
[self.timer invalidate];
self.timer = nil;
}
}
#pragma mark Private Methods
- (void)initialization {
//
self.clipsToBounds = YES;
self.isChangeAlpha = YES;
self.isAutoScroll = YES;
self.isInfiniteLoop = YES;
self.minimumCellAlpha = 1.0f;
self.autoScrollTime = 3.0f;
// scrollView
[self addSubview:self.scrollView];
}
- (void)initialScrollViewAndCellSize {
self.originSize = self.bounds.size;
[self updateScrollViewAndCellSize];
//
if (self.defaultSelectIndex >= 0 && self.defaultSelectIndex < self.realCount) {
[self handleCellScrollWithIndex:self.defaultSelectIndex];
}
}
- (void)updateScrollViewAndCellSize {
if (self.bounds.size.width <= 0 || self.bounds.size.height <= 0) return;
// cell
self.cellSize = CGSizeMake(self.bounds.size.width - 2 * self.leftRightMargin, self.bounds.size.height - 2 * self.topBottomMargin);
if (self.delegate && [self.delegate respondsToSelector:@selector(sizeForCellInCycleScrollView:)]) {
self.cellSize = [self.delegate sizeForCellInCycleScrollView:self];
}
// scrollView
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal: {
self.scrollView.frame = CGRectMake(0, 0, self.cellSize.width, self.cellSize.height);
self.scrollView.contentSize = CGSizeMake(self.cellSize.width * self.showCount,0);
self.scrollView.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
if (self.realCount > 1) {
CGPoint offset = CGPointZero;
if (self.isInfiniteLoop) { //
//
offset = CGPointMake(self.cellSize.width * (self.realCount + self.defaultSelectIndex), 0);
self.timerIndex = self.realCount + self.defaultSelectIndex;
}else {
offset = CGPointMake(self.cellSize.width * self.defaultSelectIndex, 0);
self.timerIndex = self.defaultSelectIndex;
}
[self.scrollView setContentOffset:offset animated:NO];
//
if (self.isAutoScroll) {
[self startTimer];
}
}
}
break;
case GKCycleScrollViewScrollDirectionVertical: {
self.scrollView.frame = CGRectMake(0, 0, self.cellSize.width, self.cellSize.height);
self.scrollView.contentSize = CGSizeMake(0, self.cellSize.height * self.showCount);
self.scrollView.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
if (self.realCount > 1) {
CGPoint offset = CGPointZero;
if (self.isInfiniteLoop) { //
//
offset = CGPointMake(0, self.cellSize.height * (self.realCount + self.defaultSelectIndex));
self.timerIndex = self.realCount + self.defaultSelectIndex;
}else {
offset = CGPointMake(0, self.cellSize.height * self.defaultSelectIndex);
self.timerIndex = self.defaultSelectIndex;
}
[self.scrollView setContentOffset:offset animated:NO];
//
if (self.isAutoScroll) {
[self startTimer];
}
}
}
break;
default:
break;
}
// scrollViewoffsetcell
[self setupCellsWithContentOffset:self.scrollView.contentOffset];
// cell
[self updateVisibleCellAppearance];
}
- (void)setupCellsWithContentOffset:(CGPoint)offset {
if (self.showCount == 0) return;
if (self.cellSize.width <= 0 || self.cellSize.height <= 0) return;
//_visibleRange
CGFloat originX = self.scrollView.frame.origin.x == 0 ? 0.01 : self.scrollView.frame.origin.x;
CGFloat originY = self.scrollView.frame.origin.y == 0 ? 0.01 : self.scrollView.frame.origin.y;
CGPoint startPoint = CGPointMake(offset.x - originX, offset.y - originY);
CGPoint endPoint = CGPointMake(offset.x + self.scrollView.frame.size.width + originX, offset.y + self.scrollView.frame.size.height + originY);
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal: {
NSInteger startIndex = 0;
for (NSInteger i = 0; i < self.visibleCells.count; i++) {
if (self.cellSize.width * (i + 1) > startPoint.x) {
startIndex = i;
break;
}
}
NSInteger endIndex = startIndex;
for (NSInteger i = startIndex; i < self.visibleCells.count; i++) {
//
if ((self.cellSize.width * (i + 1) < endPoint.x && self.cellSize.width * (i + 2) >= endPoint.x) || i + 2 == self.visibleCells.count) {
endIndex = i + 1;
break;
}
}
//
startIndex = MAX(startIndex, 0);
endIndex = MIN(endIndex, self.visibleCells.count - 1);
self.visibleRange = NSMakeRange(startIndex, endIndex - startIndex + 1);
for (NSInteger i = startIndex; i <= endIndex; i++) {
[self addCellAtIndex:i];
}
for (NSInteger i = 0; i < startIndex; i ++) {
[self removeCellAtIndex:i];
}
for (NSInteger i = endIndex + 1; i < self.visibleCells.count; i ++) {
[self removeCellAtIndex:i];
}
}
break;
case GKCycleScrollViewScrollDirectionVertical: {
NSInteger startIndex = 0;
for (NSInteger i = 0; i < self.visibleCells.count; i++) {
if (self.cellSize.height * (i +1) > startPoint.y) {
startIndex = i;
break;
}
}
NSInteger endIndex = startIndex;
for (NSInteger i = startIndex; i < self.visibleCells.count; i++) {
//
if ((self.cellSize.height * (i + 1) < endPoint.y && self.cellSize.height * (i + 2) >= endPoint.y) || i+ 2 == self.visibleCells.count) {
endIndex = i + 1;//i+2 index1
break;
}
}
//
startIndex = MAX(startIndex - 1, 0);
endIndex = MIN(endIndex + 1, self.visibleCells.count - 1);
self.visibleRange = NSMakeRange(startIndex, endIndex - startIndex + 1);
for (NSInteger i = startIndex; i <= endIndex; i++) {
[self addCellAtIndex:i];
}
for (NSInteger i = 0; i < startIndex; i ++) {
[self removeCellAtIndex:i];
}
for (NSInteger i = endIndex + 1; i < self.visibleCells.count; i ++) {
[self removeCellAtIndex:i];
}
break;
}
default:
break;
}
}
- (void)updateVisibleCellAppearance {
if (self.showCount == 0) return;
if (self.cellSize.width <= 0 || self.cellSize.height <= 0) return;
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal:{
CGFloat offsetX = self.scrollView.contentOffset.x;
for (NSInteger i = self.visibleRange.location; i < NSMaxRange(self.visibleRange); i++) {
GKCycleScrollViewCell *cell = self.visibleCells[i];
if ((NSObject *)cell == [NSNull null]) continue;
CGFloat originX = cell.frame.origin.x;
CGFloat delta = fabs(originX - offsetX);
CGRect originCellFrame = (CGRect){{self.cellSize.width * i, 0}, self.cellSize};
CGFloat leftRightInset = 0;
CGFloat topBottomInset = 0;
CGFloat alpha = 0;
if (delta < self.cellSize.width) {
alpha = (delta / self.cellSize.width) * self.minimumCellAlpha;
CGFloat adjustLeftRightMargin = self.leftRightMargin == 0 ? 0 : self.leftRightMargin + 1;
CGFloat adjustTopBottomMargin = self.topBottomMargin == 0 ? 0 : self.topBottomMargin;
leftRightInset = adjustLeftRightMargin * delta / self.cellSize.width;
topBottomInset = adjustTopBottomMargin * delta / self.cellSize.width;
NSInteger index = self.realCount == 0 ? 0 : i % self.realCount;
if (index == self.currentSelectIndex) {
[self.scrollView bringSubviewToFront:cell];
}
} else {
alpha = self.minimumCellAlpha;
leftRightInset = self.leftRightMargin;
topBottomInset = self.topBottomMargin;
[self.scrollView sendSubviewToBack:cell];
}
if (self.leftRightMargin == 0 && self.topBottomMargin == 0) {
cell.frame = originCellFrame;
}else {
CGFloat scaleX = (self.cellSize.width - leftRightInset * 2) / self.cellSize.width;
CGFloat scaleY = (self.cellSize.height - topBottomInset * 2) / self.cellSize.height;
UIEdgeInsets insets = UIEdgeInsetsMake(topBottomInset, leftRightInset - 0.1, topBottomInset, leftRightInset);
cell.layer.transform = CATransform3DMakeScale(scaleX, scaleY, 1.0);
cell.frame = UIEdgeInsetsInsetRect(originCellFrame, insets);
}
// cell
if (cell.tag == self.currentSelectIndex) {
self.currentCell = cell;
}
//
if (self.isChangeAlpha) {
cell.coverView.alpha = alpha;
}
}
}
break;
case GKCycleScrollViewScrollDirectionVertical:{
CGFloat offsetY = self.scrollView.contentOffset.y;
for (NSInteger i = self.visibleRange.location; i < NSMaxRange(self.visibleRange); i++) {
GKCycleScrollViewCell *cell = self.visibleCells[i];
if ((NSObject *)cell == [NSNull null]) continue;
CGFloat originY = cell.frame.origin.y;
CGFloat delta = fabs(originY - offsetY);
CGRect originCellFrame = (CGRect){{0, self.cellSize.height * i}, self.cellSize};
CGFloat leftRightInset = 0;
CGFloat topBottomInset = 0;
CGFloat alpha = 0;
if (delta < self.cellSize.height) {
alpha = (delta / self.cellSize.height) * self.minimumCellAlpha;
CGFloat adjustLeftRightMargin = self.leftRightMargin == 0 ? 0 : self.leftRightMargin;
CGFloat adjustTopBottomMargin = self.topBottomMargin == 0 ? 0 : self.topBottomMargin + 1;
leftRightInset = adjustLeftRightMargin * delta / self.cellSize.height;
topBottomInset = adjustTopBottomMargin * delta / self.cellSize.height;
NSInteger index = self.realCount == 0 ? 0 : i % self.realCount;
if (index == self.currentSelectIndex) {
[self.scrollView bringSubviewToFront:cell];
}
} else {
alpha = self.minimumCellAlpha;
leftRightInset = self.leftRightMargin;
topBottomInset = self.topBottomMargin;
[self.scrollView sendSubviewToBack:cell];
}
if (self.leftRightMargin == 0 && self.topBottomMargin == 0) {
cell.frame = originCellFrame;
}else {
CGFloat scaleX = (self.cellSize.width - leftRightInset * 2) / self.cellSize.width;
CGFloat scaleY = (self.cellSize.height - topBottomInset * 2) / self.cellSize.height;
UIEdgeInsets insets = UIEdgeInsetsMake(topBottomInset - 0.1, leftRightInset, topBottomInset, leftRightInset);
cell.layer.transform = CATransform3DMakeScale(scaleX, scaleY, 1.0f);
cell.frame = UIEdgeInsetsInsetRect(originCellFrame, insets);
}
//
if (self.isChangeAlpha) {
cell.coverView.alpha = alpha;
}
}
}
break;
default:
break;
}
}
- (void)addCellAtIndex:(NSInteger)index {
NSParameterAssert(index >= 0 && index < self.visibleCells.count);
GKCycleScrollViewCell *cell = self.visibleCells[index];
if ((NSObject *)cell == [NSNull null]) {
cell = [self.dataSource cycleScrollView:self cellForViewAtIndex:index % self.realCount];
if (cell) {
[self.visibleCells replaceObjectAtIndex:index withObject:cell];
cell.tag = index % self.realCount;
[cell setupCellFrame:CGRectMake(0, 0, self.cellSize.width, self.cellSize.height)];
if (!self.isChangeAlpha) cell.coverView.hidden = YES;
__weak __typeof(self) weakSelf = self;
cell.didCellClick = ^(NSInteger index) {
[weakSelf handleCellSelectWithIndex:index];
};
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal:
cell.frame = CGRectMake(self.cellSize.width * index, 0, self.cellSize.width, self.cellSize.height);
break;
case GKCycleScrollViewScrollDirectionVertical:
cell.frame = CGRectMake(0, self.cellSize.height * index, self.cellSize.width, self.cellSize.height);
break;
default:
break;
}
if (!cell.superview) {
[self.scrollView addSubview:cell];
}
}
}
}
- (void)removeCellAtIndex:(NSInteger)index{
GKCycleScrollViewCell *cell = self.visibleCells[index];
if ((NSObject *)cell == [NSNull null]) return;
[self.reusableCells addObject:cell];
if (cell.superview) {
[cell removeFromSuperview];
}
[self.visibleCells replaceObjectAtIndex:index withObject:[NSNull null]];
}
- (void)handleCellSelectWithIndex:(NSInteger)index {
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didSelectCellAtIndex:)]) {
[self.delegate cycleScrollView:self didSelectCellAtIndex:index];
}
}
- (void)handleCellScrollWithIndex:(NSInteger)index {
self.currentSelectIndex = index;
if (self.pageControl && [self.pageControl respondsToSelector:@selector(setCurrentPage:)]) {
self.pageControl.currentPage = index;
}
// cell
for (NSInteger i = self.visibleRange.location; i < NSMaxRange(self.visibleRange); i++) {
GKCycleScrollViewCell *cell = self.visibleCells[i];
if ((NSObject *)cell == [NSNull null]) continue;
if (cell.tag == index) {
self.currentCell = cell;
}
}
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didScrollCellToIndex:)]) {
[self.delegate cycleScrollView:self didScrollCellToIndex:index];
}
}
- (void)timerUpdate {
self.timerIndex++;
// bug fixed
if (self.timerIndex > self.realCount * 2) {
self.timerIndex = self.realCount * 2;
}
if (!self.isInfiniteLoop) {
if (self.timerIndex >= self.realCount) {
self.timerIndex = 0;
}
}
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal: {
[self.scrollView setContentOffset:CGPointMake(self.cellSize.width * self.timerIndex, 0) animated:YES];
}
break;
case GKCycleScrollViewScrollDirectionVertical: {
[self.scrollView setContentOffset:CGPointMake(0, self.cellSize.height * self.timerIndex) animated:YES];
}
break;
default:
break;
}
}
#pragma mark UIScrollView Delegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
if (self.realCount == 0) return;
if (self.cellSize.width <= 0 || self.cellSize.height <= 0) return;
NSInteger index = 0;
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal: {
index = (NSInteger)round(self.scrollView.contentOffset.x / self.cellSize.width) % self.realCount;
}
break;
case GKCycleScrollViewScrollDirectionVertical: {
index = (NSInteger)round(self.scrollView.contentOffset.y / self.cellSize.height) % self.realCount;
}
break;
default:
break;
}
if (self.isInfiniteLoop) {
if (self.realCount > 1) {
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal: {
CGFloat horIndex = scrollView.contentOffset.x / self.cellSize.width;
if (horIndex >= 2 * self.realCount) {
scrollView.contentOffset = CGPointMake(self.cellSize.width * self.realCount, 0);
self.timerIndex = self.realCount;
}
if (horIndex <= (self.realCount - 1)) {
scrollView.contentOffset = CGPointMake(self.cellSize.width * (2 * self.realCount - 1), 0);
self.timerIndex = 2 * self.realCount - 1;
}
}
break;
case GKCycleScrollViewScrollDirectionVertical: {
NSInteger verIndex = scrollView.contentOffset.y / self.cellSize.height;
if (verIndex >= 2 * self.realCount) {
scrollView.contentOffset = CGPointMake(0, self.cellSize.height * self.realCount);
self.timerIndex = self.realCount;
}
if (verIndex <= (self.realCount - 1)) {
scrollView.contentOffset = CGPointMake(0, self.cellSize.height * (2 * self.realCount - 1));
self.timerIndex = 2 * self.realCount - 1;
}
}
break;
default:
break;
}
}else {
index = 0;
}
}
[self setupCellsWithContentOffset:scrollView.contentOffset];
[self updateVisibleCellAppearance];
if (index >= 0 && self.currentSelectIndex != index) {
[self handleCellScrollWithIndex:index];
}
[self handleScrollViewDidScroll:scrollView];
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
[self stopTimer];
if ([self.delegate respondsToSelector:@selector(cycleScrollView:willBeginDragging:)]) {
[self.delegate cycleScrollView:self willBeginDragging:scrollView];
}
}
// decelerate
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (!decelerate) {
[self startTimer];
}
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didEndDragging:willDecelerate:)]) {
[self.delegate cycleScrollView:self didEndDragging:scrollView willDecelerate:decelerate];
}
}
//
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
[self startTimer];
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didEndDecelerating:)]) {
[self.delegate cycleScrollView:self didEndDecelerating:scrollView];
}
}
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset {
if (self.realCount > 1 && self.isAutoScroll) {
switch (self.direction) {
case GKCycleScrollViewScrollDirectionHorizontal: {
NSInteger index = round(targetContentOffset->x / self.cellSize.width);
self.timerIndex = index;
}
break;
case GKCycleScrollViewScrollDirectionVertical: {
NSInteger index = round(targetContentOffset->y / self.cellSize.height);
self.timerIndex = index;
}
break;
default:
break;
}
}
}
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
[self updateVisibleCellAppearance];
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didEndScrollingAnimation:)]) {
[self.delegate cycleScrollView:self didEndScrollingAnimation:scrollView];
}
}
- (void)handleScrollViewDidScroll:(UIScrollView *)scrollView {
if ([self.delegate respondsToSelector:@selector(cycleScrollView:didScroll:)]) {
[self.delegate cycleScrollView:self didScroll:scrollView];
}
if ([self.delegate respondsToSelector:@selector(cycleScrollView:scrollingFromIndex:toIndex:ratio:)]) {
BOOL isFirstRevirse = NO; //
CGFloat ratio = 0; //
if (self.direction == GKCycleScrollViewScrollDirectionHorizontal) {
CGFloat offsetX = scrollView.contentOffset.x;
CGFloat maxW = self.realCount * scrollView.bounds.size.width;
CGFloat changeOffsetX = self.isInfiniteLoop ? (offsetX - maxW) : offsetX;
if (changeOffsetX < 0) {
changeOffsetX = -changeOffsetX;
isFirstRevirse = YES;
}
ratio = (changeOffsetX / scrollView.bounds.size.width);
}else if (self.direction == GKCycleScrollViewScrollDirectionVertical) {
CGFloat offsetY = scrollView.contentOffset.y;
CGFloat maxW = self.realCount * scrollView.bounds.size.height;
CGFloat changeOffsetY = self.isInfiniteLoop ? (offsetY - maxW) : offsetY;
if (changeOffsetY < 0) {
changeOffsetY = -changeOffsetY;
isFirstRevirse = YES;
}
ratio = (changeOffsetY / scrollView.bounds.size.height);
}
if (ratio > self.realCount || ratio < 0) return; //
ratio = MAX(0, MIN(self.realCount, ratio));
NSInteger baseIndex = floor(ratio);
if (baseIndex + 1 > self.realCount) {
//
baseIndex = 0;
}
CGFloat remainderRatio = ratio - baseIndex;
if (remainderRatio <= 0 || remainderRatio >= 1) return;
NSInteger toIndex = 0;
if (isFirstRevirse) {
baseIndex = self.realCount - 1;
toIndex = 0;
remainderRatio = 1 - remainderRatio;
}else if (baseIndex == self.realCount - 1) {
toIndex = 0;
}else {
toIndex = baseIndex + 1;
}
[self.delegate cycleScrollView:self scrollingFromIndex:baseIndex toIndex:toIndex ratio:remainderRatio];
}
}
#pragma mark -
- (UIScrollView *)scrollView {
if (!_scrollView) {
_scrollView = [[UIScrollView alloc] initWithFrame:self.bounds];
_scrollView.scrollsToTop = NO;
_scrollView.delegate = self;
_scrollView.pagingEnabled = YES;
_scrollView.clipsToBounds = NO;
_scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.showsVerticalScrollIndicator = NO;
}
return _scrollView;
}
- (NSMutableArray *)visibleCells {
if (!_visibleCells) {
_visibleCells = [NSMutableArray new];
}
return _visibleCells;
}
- (NSMutableArray *)reusableCells {
if (!_reusableCells) {
_reusableCells = [NSMutableArray new];
}
return _reusableCells;
}
@end

View File

@@ -0,0 +1,28 @@
//
// GKCycleScrollViewCell.h
// GKCycleScrollViewDemo
//
// Created by QuintGao on 2019/9/15.
// Copyright © 2019 QuintGao. All rights reserved.
//
#import <UIKit/UIKit.h>
@class GKCycleScrollViewCell;
typedef void(^cellClickBlock)(NSInteger index);
@interface GKCycleScrollViewCell : UIView
/// 图片视图
@property (nonatomic, strong) UIImageView *imageView;
/// 遮罩视图,用于处理透明度渐变
@property (nonatomic, strong) UIView *coverView;
/// cell点击回调
@property (nonatomic, copy) cellClickBlock didCellClick;
- (void)setupCellFrame:(CGRect)frame;
@end

View File

@@ -0,0 +1,54 @@
//
// GKCycleScrollViewCell.m
// GKCycleScrollViewDemo
//
// Created by QuintGao on 2019/9/15.
// Copyright © 2019 QuintGao. All rights reserved.
//
#import "GKCycleScrollViewCell.h"
@implementation GKCycleScrollViewCell
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.clipsToBounds = YES;
[self addSubview:self.imageView];
[self addSubview:self.coverView];
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
[self addGestureRecognizer:tapGesture];
}
return self;
}
- (void)handleTapGesture:(UITapGestureRecognizer *)tap {
!self.didCellClick ? : self.didCellClick(self.tag);
}
- (void)setupCellFrame:(CGRect)frame {
if (CGRectEqualToRect(self.imageView.frame, frame)) return;
self.imageView.frame = frame;
self.coverView.frame = frame;
}
#pragma mark -
- (UIImageView *)imageView {
if (!_imageView) {
_imageView = [UIImageView new];
}
return _imageView;
}
- (UIView *)coverView {
if (!_coverView) {
_coverView = [UIView new];
_coverView.backgroundColor = [UIColor blackColor];
_coverView.userInteractionEnabled = NO;
}
return _coverView;
}
@end

View File

@@ -0,0 +1,38 @@
//
// GKPageControl.h
// GKCycleScrollViewDemo
//
// Created by QuintGao on 2019/9/21.
// Copyright © 2019 QuintGao. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, GKPageControlStyle) {
GKPageControlStyleSystem, // 系统,默认类型
GKPageControlStyleCycle, // 圆形
GKPageControlStyleRectangle, // 长方形
GKPageControlStyleSquare, // 正方形
GKPageControlStyleSizeDot // 大小点
};
@interface GKPageControl : UIPageControl
/// pageControl类型
@property (nonatomic, assign) GKPageControlStyle style;
/// 以下属性在style为GKPageControlStyleSizeDot时有效
/// 默认8 长方形默认16
@property (nonatomic, assign) CGFloat dotWidth;
/// 默认8 长方形默认2
@property (nonatomic, assign) CGFloat dotHeight;
/// 默认8
@property (nonatomic, assign) CGFloat dotMargin;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,271 @@
//
// GKPageControl.m
// GKCycleScrollViewDemo
//
// Created by QuintGao on 2019/9/21.
// Copyright © 2019 QuintGao. All rights reserved.
//
#import "GKPageControl.h"
@interface GKPageDotView : UIView
@property (nonatomic, assign) NSInteger numberOfPages;
@property (nonatomic, assign) NSInteger currentPage;
@property (nonatomic, strong) UIColor *pageIndicatorColor;
@property (nonatomic, strong) UIColor *currentPageIndicatorColor;
@property (nonatomic, assign) CGFloat dotWidth;
@property (nonatomic, assign) CGFloat dotHeight;
@property (nonatomic, assign) CGFloat dotMargin;
@end
@implementation GKPageDotView
- (void)setCurrentPage:(NSInteger)currentPage {
if (_currentPage == currentPage) return;
_currentPage = MIN(currentPage, self.numberOfPages - 1);
for (NSInteger i = 0; i < self.numberOfPages; i++) {
UIView *dotView = self.subviews[i];
if (currentPage == i) {
dotView.backgroundColor = self.currentPageIndicatorColor;
}else {
dotView.backgroundColor = self.pageIndicatorColor;
}
}
[self layoutSubviews];
}
- (void)setNumberOfPages:(NSInteger)numberOfPages {
if (_numberOfPages == numberOfPages) return;
_numberOfPages = MAX(0, numberOfPages);
[self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
for (NSInteger i = 0; i < numberOfPages; i++) {
UIView *dotView = [UIView new];
if (self.currentPage == i) {
dotView.backgroundColor = self.currentPageIndicatorColor;
}else {
dotView.backgroundColor = self.pageIndicatorColor;
}
dotView.layer.cornerRadius = self.dotHeight * 0.5f;
dotView.layer.masksToBounds = YES;
[self addSubview:dotView];
}
[self layoutSubviews];
}
- (void)layoutSubviews {
[super layoutSubviews];
CGFloat selectW = 2 * self.dotWidth + self.dotMargin;
CGFloat viewX = (self.frame.size.width - self.dotWidth * (self.numberOfPages + 1) - self.dotMargin * self.numberOfPages) / 2;
CGFloat viewY = (self.frame.size.height - self.dotHeight) / 2;
for (NSInteger i = 0; i < self.numberOfPages; i++) {
UIView *dotView = self.subviews[i];
if (self.currentPage == i) {
dotView.frame = CGRectMake(viewX, viewY, selectW, self.dotHeight);
viewX += selectW + self.dotMargin;
}else {
dotView.frame = CGRectMake(viewX, viewY, self.dotWidth, self.dotHeight);
viewX += self.dotWidth + self.dotMargin;
}
}
}
@end
@interface GKPageControl()
@property (nonatomic, strong) GKPageDotView *pageDotView;
@end
@implementation GKPageControl
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
self.pageIndicatorTintColor = [UIColor grayColor];
self.currentPageIndicatorTintColor = [UIColor whiteColor];
self.dotWidth = 8;
self.dotHeight = 8;
self.dotMargin = 8;
}
return self;
}
- (void)setStyle:(GKPageControlStyle)style {
_style = style;
if (style == GKPageControlStyleRectangle) {
self.dotWidth = 20;
self.dotHeight = 4;
}else if (style == GKPageControlStyleSizeDot) {
self.pageDotView.dotWidth = self.dotWidth;
self.pageDotView.dotHeight = self.dotHeight;;
self.pageDotView.dotMargin = self.dotMargin;
[self.pageDotView layoutSubviews];
}
}
- (void)setDotWidth:(CGFloat)dotWidth {
_dotWidth = dotWidth;
if (self.style == GKPageControlStyleSizeDot) {
self.pageDotView.dotWidth = dotWidth;
[self.pageDotView layoutSubviews];
}
}
- (void)setDotHeight:(CGFloat)dotHeight {
_dotHeight = dotHeight;
if (self.style == GKPageControlStyleSizeDot) {
self.pageDotView.dotHeight = dotHeight;
[self.pageDotView layoutSubviews];
}
}
- (void)setDotMargin:(CGFloat)dotMargin {
_dotMargin = dotMargin;
if (self.style == GKPageControlStyleSizeDot) {
self.pageDotView.dotMargin = dotMargin;
[self.pageDotView layoutSubviews];
}
}
- (void)setNumberOfPages:(NSInteger)numberOfPages {
[super setNumberOfPages:numberOfPages];
if (self.style == GKPageControlStyleSystem) return;
[self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
if (self.style == GKPageControlStyleSizeDot) {
[self addSubview:self.pageDotView];
self.pageDotView.numberOfPages = numberOfPages;
return;
}
for (NSInteger i = 0; i < numberOfPages; i++) {
UIView *dotView = [UIView new];
dotView.tag = [dotView hash] + i;
if (self.hidesForSinglePage && numberOfPages == 1) {
dotView.hidden = YES;
}
[self addSubview:dotView];
}
}
- (void)setCurrentPage:(NSInteger)currentPage {
[super setCurrentPage:currentPage];
if (self.style == GKPageControlStyleSystem) return;
if (self.style == GKPageControlStyleSizeDot) {
self.pageDotView.currentPage = currentPage;
return;
}
[super setCurrentPage:currentPage];
[self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
obj.backgroundColor = currentPage == idx ? self.currentPageIndicatorTintColor : self.pageIndicatorTintColor;
}];
}
- (void)setPageIndicatorTintColor:(UIColor *)pageIndicatorTintColor {
[super setPageIndicatorTintColor:pageIndicatorTintColor];
if (self.style == GKPageControlStyleSizeDot) {
self.pageDotView.pageIndicatorColor = pageIndicatorTintColor;
}
}
- (void)setCurrentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor {
[super setCurrentPageIndicatorTintColor:currentPageIndicatorTintColor];
if (self.style == GKPageControlStyleSizeDot) {
self.pageDotView.currentPageIndicatorColor = currentPageIndicatorTintColor;
}
}
- (void)layoutSubviews {
[super layoutSubviews];
if (self.style == GKPageControlStyleSystem) return;
[self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if (obj.tag == [obj hash] + idx) {
switch (self.style) {
case GKPageControlStyleCycle: {
CGFloat objW = self.dotWidth;
CGFloat objH = self.dotHeight;
CGFloat originX = (self.frame.size.width - objW * self.numberOfPages - self.dotMargin * (self.numberOfPages - 1)) / 2;
CGFloat objX = originX + (self.dotMargin + objW) * idx;
CGFloat objy = (self.frame.size.height - objH) / 2;
obj.frame = CGRectMake(objX, objy, objW, objH);
obj.layer.cornerRadius = objW / 2;
obj.layer.masksToBounds = YES;
}
break;
case GKPageControlStyleRectangle: {
CGFloat objW = self.dotWidth;
CGFloat objH = self.dotHeight;
CGFloat originX = (self.frame.size.width - objW * self.numberOfPages - self.dotMargin * (self.numberOfPages - 1)) / 2;
CGFloat objX = originX + (self.dotMargin + objW) * idx;
CGFloat objy = (self.frame.size.height - objH) / 2;
obj.layer.cornerRadius = 2.5;
obj.layer.masksToBounds = YES;
obj.frame = CGRectMake(objX, objy, objW, objH);
}
break;
case GKPageControlStyleSquare: {
CGFloat objW = self.dotWidth;
CGFloat objH = self.dotHeight;
CGFloat originX = (self.frame.size.width - objW * self.numberOfPages - self.dotMargin * (self.numberOfPages - 1)) / 2;
CGFloat objX = originX + (self.dotMargin + objW) * idx;
CGFloat objy = (self.frame.size.height - objH) / 2;
obj.frame = CGRectMake(objX, objy, objW, objH);
}
break;
case GKPageControlStyleSizeDot:
obj.frame = self.bounds;
break;
default:
break;
}
}else {
[obj removeFromSuperview];
}
}];
}
#pragma mark -
- (GKPageDotView *)pageDotView {
if (!_pageDotView) {
_pageDotView = [[GKPageDotView alloc] initWithFrame:self.bounds];
_pageDotView.pageIndicatorColor = self.pageIndicatorTintColor;
_pageDotView.currentPageIndicatorColor = self.currentPageIndicatorTintColor;
_pageDotView.tag = [_pageDotView hash];
}
return _pageDotView;
}
@end

View File

@@ -0,0 +1,44 @@
//
// QXGiftScrollView.h
// QXLive
//
// Created by 启星 on 2025/5/13.
//
#import <UIKit/UIKit.h>
#import "MarqueeLabel.h"
NS_ASSUME_NONNULL_BEGIN
@class QXGiftScrollView,QXGiftScrollViewCell,QXGiftScrollModel;
@protocol QXGiftScrollViewDelegate <NSObject>
@optional
-(void)didClickGiftScrollView:(QXGiftScrollView*)giftScrollView index:(NSInteger)index model:(QXGiftScrollModel*)model;
@end
@interface QXGiftScrollView : UIView
@property (nonatomic,strong)QXGiftScrollModel *model;
@property (nonatomic,weak)id<QXGiftScrollViewDelegate>delegate;
@end
@interface QXGiftScrollViewCell : UICollectionViewCell
@property (nonatomic,strong)UIImageView *noticeImageView;
@property (nonatomic,strong)MarqueeLabel *titleLabel;
@property (nonatomic,strong)UIImageView *gotoRoomImageView;
@property (nonatomic,strong)QXGiftScrollModel *model;
@end
@interface QXGiftScrollModel : QXBaseModel
@property (nonatomic,strong)NSString *fromUserName;
@property (nonatomic,strong)NSString *toUserName;
@property (nonatomic,strong)NSString *giftName;
@property (nonatomic,strong)NSString *gift_picture;
@property (nonatomic,strong)NSString *roomId;
@property (nonatomic,strong)NSString *number;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,124 @@
//
// QXGiftScrollView.m
// QXLive
//
// Created by on 2025/5/13.
//
#import "QXGiftScrollView.h"
#import <SDCycleScrollView/SDCycleScrollView.h>
static NSInteger maxCount = 5;
@interface QXGiftScrollView()<SDCycleScrollViewDelegate>
@property (nonatomic,strong)SDCycleScrollView *cycleScrollView;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)NSMutableArray *titles;
@end
@implementation QXGiftScrollView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
}
return self;
}
-(void)initSubViews{
[self addRoundedCornersWithRadius:15.5];
self.layer.borderWidth = 2;
self.layer.borderColor = RGB16(0x333333).CGColor;
self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:self.bounds delegate:self placeholderImage:nil];
self.cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleNone;
self.cycleScrollView.scrollDirection = UICollectionViewScrollDirectionVertical;
self.cycleScrollView.delegate = self;
[self addSubview:self.cycleScrollView];
}
-(void)setModel:(QXGiftScrollModel *)model{
_model = model;
[self.dataArray insertObject:model atIndex:0];
[self.titles insertObject:model.fromUserName atIndex:0];
if (self.dataArray.count > 5) {
[self.dataArray removeLastObject];
[self.titles removeLastObject];
}
self.cycleScrollView.imageURLStringsGroup = self.titles;
}
- (Class)customCollectionViewCellClassForCycleScrollView:(SDCycleScrollView *)view{
return [QXGiftScrollViewCell class];
}
- (void)setupCustomCell:(UICollectionViewCell *)cell forIndex:(NSInteger)index cycleScrollView:(SDCycleScrollView *)view{
QXGiftScrollViewCell *myCell = (QXGiftScrollViewCell *)cell;
myCell.model = self.dataArray[index];
}
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickGiftScrollView:index:model:)]) {
[self.delegate didClickGiftScrollView:self index:index model:self.dataArray[index]];
}
}
-(NSMutableArray *)dataArray{
if (!_dataArray) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
-(NSMutableArray *)titles{
if (!_titles) {
_titles = [NSMutableArray array];
}
return _titles;
}
@end
@implementation QXGiftScrollViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
}
return self;
}
- (void)setModel:(QXGiftScrollModel *)model{
_model = model;
self.titleLabel.text = [NSString stringWithFormat:@"%@%@%@ %@X%@",model.fromUserName,QXText(@"送给了"),model.toUserName,model.giftName,model.number];
}
-(void)initSubViews{
self.gotoRoomImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_goto_room"]];
[self.contentView addSubview:self.gotoRoomImageView];
[self.gotoRoomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.bottom.equalTo(self);
make.width.mas_equalTo(85);
}];
self.noticeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_notice"]];
[self.contentView addSubview:self.noticeImageView];
[self.noticeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(12);
make.centerY.equalTo(self);
make.size.mas_equalTo(CGSizeMake(24, 24));
}];
self.titleLabel = [[MarqueeLabel alloc] initWithFrame:CGRectZero];
self.titleLabel.scrollDuration = 2;
self.titleLabel.marqueeType = MLLeftRight;
self.titleLabel.textColor = QXConfig.textColor;
self.titleLabel.font = [UIFont systemFontOfSize:14];
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.equalTo(self);
make.left.equalTo(self.noticeImageView.mas_right).offset(8);
make.right.equalTo(self.gotoRoomImageView.mas_left).offset(-8);
}];
}
@end
@implementation QXGiftScrollModel
@end

View File

@@ -0,0 +1,16 @@
//
// QXHomeBannerView.h
// QXLive
//
// Created by 启星 on 2025/5/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXHomeBannerView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,20 @@
//
// QXHomeBannerView.m
// QXLive
//
// Created by on 2025/5/13.
//
#import "QXHomeBannerView.h"
@implementation QXHomeBannerView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,28 @@
//
// QXHomeRoomCell.h
// IsLandVoice
//
// Created by 启星 on 2025/4/12.
//
#import <UIKit/UIKit.h>
#import "QXRoomListModel.h"
#import "QXSearchModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXHomeRoomCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIImageView *coverImageView;
@property (weak, nonatomic) IBOutlet UIView *displayMaskView;
@property (weak, nonatomic) IBOutlet UILabel *IDLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *countLabel;
@property (weak, nonatomic) IBOutlet UIImageView *roomTypeView;
@property (weak, nonatomic) IBOutlet UIImageView *animateImageView;
@property (strong, nonatomic) QXRoomListModel *model;
@property (strong, nonatomic) QXMyRoomHistory *historyModel;
@property (strong, nonatomic) QXSearchModel *searchModel;
@property (assign, nonatomic) BOOL isAppStore;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,95 @@
//
// QXHomeRoomCell.m
// IsLandVoice
//
// Created by on 2025/4/12.
//
#import "QXHomeRoomCell.h"
@interface QXHomeRoomCell()
@property (nonatomic,strong)NSMutableArray *imgs;
@end
@implementation QXHomeRoomCell
- (void)setModel:(QXRoomListModel *)model{
_model = model;
[self.coverImageView sd_setImageWithURL:[NSURL URLWithString:model.room_cover]];
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",model.room_number];
self.nameLabel.text = [NSString stringWithFormat:@"%@",model.room_name];
self.countLabel.text = [NSString qx_showHotCountNum:model.hot_value.longLongValue];
// if ([model.label_id isEqualToString:@"23"]) {
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7153"];
// }else if ([model.label_id isEqualToString:@"108"]){
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7154"];
// }else if ([model.label_id isEqualToString:@"101"]){
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7155"];
// }else if ([model.label_id isEqualToString:@"121"]){
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7160"];
// }else if ([model.label_id isEqualToString:@"120"]){
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7156"];
// }
[self.roomTypeView sd_setImageWithURL:[NSURL URLWithString:model.label_icon]];
self.animateImageView.animationDuration = 1;
self.animateImageView.animationImages = self.imgs;
[self.animateImageView startAnimating];
}
-(void)setHistoryModel:(QXMyRoomHistory *)historyModel{
_historyModel = historyModel;
[self.coverImageView sd_setImageWithURL:[NSURL URLWithString:historyModel.room_cover]];
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",historyModel.room_number];
self.nameLabel.text = [NSString stringWithFormat:@"%@",historyModel.room_name];
self.countLabel.text = [NSString qx_showHotCountNum:historyModel.hot_value.longLongValue];
[self.roomTypeView sd_setImageWithURL:[NSURL URLWithString:historyModel.label_icon]];
}
-(void)setSearchModel:(QXSearchModel *)searchModel{
_searchModel = searchModel;
[self.coverImageView sd_setImageWithURL:[NSURL URLWithString:searchModel.picture]];
self.IDLabel.text = [NSString stringWithFormat:@"ID:%@",searchModel.code];
self.nameLabel.text = [NSString stringWithFormat:@"%@",searchModel.name];
self.countLabel.text = [NSString qx_showHotCountNum:searchModel.hot_value.longLongValue];
[self.roomTypeView sd_setImageWithURL:[NSURL URLWithString:searchModel.label_icon]];
}
//-(void)setHotRoomModel:(SRHomeChatRoomListModel *)hotRoomModel{
// _hotRoomModel = hotRoomModel;
// [self.coverImageView sd_setImageWithURL:[NSURL URLWithString:hotRoomModel.cover_picture]];
//// self.IDLabel.text = [NSString stringWithFormat:@"ID:%lld",model.room_id];
// self.nameLabel.text = [NSString stringWithFormat:@"%@",hotRoomModel.room_name];
// self.countLabel.text = [NSString stringWithFormat:@"%@",hotRoomModel.popularity];
// if ([hotRoomModel.label_id isEqualToString:@"23"]) {
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7153"];
// }else if ([hotRoomModel.label_id isEqualToString:@"108"]){
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7154"];
// }else if ([hotRoomModel.label_id isEqualToString:@"101"]){
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7155"];
// }else if ([hotRoomModel.label_id isEqualToString:@"121"]){
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7160"];
// }else if ([hotRoomModel.label_id isEqualToString:@"120"]){
// self.roomTypeView.image = [UIImage imageNamed:@"Group 7156"];
// }
//
// self.animateImageView.animationDuration = 1;
// self.animateImageView.animationImages = self.imgs;
// [self.animateImageView startAnimating];
//}
-(NSMutableArray *)imgs{
if (!_imgs) {
_imgs = [NSMutableArray array];
for (int i = 0; i < 14; i++) {
NSString *str = [NSString stringWithFormat:@"Flow 100%02d",i];
UIImage *img = [UIImage imageNamed:str];
[_imgs addObject:img];
}
}
return _imgs;
}
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
if (self.isAppStore) {
[self.displayMaskView setTopToBottomGradientBackgroundWithColors:@[[UIColor colorWithHexString:@"#00000000"],[UIColor colorWithHexString:@"#00000096"]] frame:CGRectMake(0, 0, ScaleWidth(90),ScaleWidth(90))];
}else{
[self.displayMaskView setTopToBottomGradientBackgroundWithColors:@[[UIColor colorWithHexString:@"#00000000"],[UIColor colorWithHexString:@"#00000096"]] frame:CGRectMake(0, 0, (SCREEN_WIDTH-15*3-1)/2.0, (SCREEN_WIDTH-15*3-1)/2.0)];
}
}
@end

View File

@@ -0,0 +1,162 @@
<?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" customClass="QXHomeRoomCell"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="QXHomeRoomCell">
<rect key="frame" x="0.0" y="0.0" width="294" height="284"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="294" height="284"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="nPz-Ym-vpk">
<rect key="frame" x="0.0" y="0.0" width="294" height="284"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="11"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="GYb-S9-FB8">
<rect key="frame" x="228" y="0.0" width="66" height="24"/>
<constraints>
<constraint firstAttribute="height" constant="24" id="92V-xR-Lhf"/>
<constraint firstAttribute="width" constant="66" id="ljY-RT-6T7"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="raq-XK-qhh">
<rect key="frame" x="0.0" y="0.0" width="294" height="284"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="11"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="074-Lr-sTa">
<rect key="frame" x="12" y="256" width="31" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="aol-6h-d9l"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qsd-Ig-Nmi">
<rect key="frame" x="12" y="258" width="28" height="14"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="T17-NM-Dxi">
<rect key="frame" x="7.6666666666666679" y="2" width="13" height="10"/>
<constraints>
<constraint firstAttribute="height" constant="10" id="Jz4-mP-9ub"/>
<constraint firstAttribute="width" constant="13" id="bFQ-Sn-QsD"/>
</constraints>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="aVk-wF-KeM"/>
<color key="backgroundColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="T17-NM-Dxi" firstAttribute="centerX" secondItem="qsd-Ig-Nmi" secondAttribute="centerX" id="1hF-Jg-jvh"/>
<constraint firstAttribute="width" constant="28" id="PWa-Xg-JLt"/>
<constraint firstItem="T17-NM-Dxi" firstAttribute="centerY" secondItem="qsd-Ig-Nmi" secondAttribute="centerY" id="VQd-l3-nt3"/>
<constraint firstAttribute="height" constant="14" id="suT-YR-dzr"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="7"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V8F-du-Rah">
<rect key="frame" x="12" y="232" width="31" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="BJy-ur-bLw"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FdH-8c-jAP">
<rect key="frame" x="207" y="254" width="75" height="22"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BSc-rv-bf4">
<rect key="frame" x="26" y="4.0000000000000009" width="41" height="14.333333333333336"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="room_hot_icon" translatesAutoresizingMaskIntoConstraints="NO" id="NbC-hm-dDF">
<rect key="frame" x="8" y="4.6666666666666856" width="13" height="13"/>
<constraints>
<constraint firstAttribute="height" constant="13" id="e3W-Ql-oEX"/>
<constraint firstAttribute="width" constant="13" id="z2G-RN-eyM"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="BSc-rv-bf4" firstAttribute="leading" secondItem="NbC-hm-dDF" secondAttribute="trailing" constant="5" id="1TS-Nb-vk6"/>
<constraint firstItem="NbC-hm-dDF" firstAttribute="leading" secondItem="FdH-8c-jAP" secondAttribute="leading" constant="8" id="4i4-XP-rtz"/>
<constraint firstItem="NbC-hm-dDF" firstAttribute="centerY" secondItem="FdH-8c-jAP" secondAttribute="centerY" id="BV7-rF-E1Y"/>
<constraint firstItem="BSc-rv-bf4" firstAttribute="centerY" secondItem="FdH-8c-jAP" secondAttribute="centerY" id="FZY-q3-vZ5"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="75" id="OI1-Rh-zJL"/>
<constraint firstAttribute="height" constant="22" id="oWJ-kZ-B8e"/>
<constraint firstAttribute="trailing" secondItem="BSc-rv-bf4" secondAttribute="trailing" constant="8" id="wk2-Xp-c2N"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="11"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
</view>
<viewLayoutGuide key="safeArea" id="SEy-5g-ep8"/>
<constraints>
<constraint firstItem="074-Lr-sTa" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="12" id="3jT-jw-g2s"/>
<constraint firstItem="raq-XK-qhh" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="65M-Vz-wVN"/>
<constraint firstItem="074-Lr-sTa" firstAttribute="top" secondItem="V8F-du-Rah" secondAttribute="bottom" constant="6" id="BXi-Dl-VEW"/>
<constraint firstItem="GYb-S9-FB8" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="Ejx-IG-t0a"/>
<constraint firstItem="qsd-Ig-Nmi" firstAttribute="centerY" secondItem="074-Lr-sTa" secondAttribute="centerY" id="HaA-HN-SwS"/>
<constraint firstItem="nPz-Ym-vpk" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="IlJ-YP-mXS"/>
<constraint firstItem="qsd-Ig-Nmi" firstAttribute="leading" secondItem="V8F-du-Rah" secondAttribute="leading" id="KWW-LZ-X3E"/>
<constraint firstItem="V8F-du-Rah" firstAttribute="leading" secondItem="074-Lr-sTa" secondAttribute="leading" id="KcI-CR-utf"/>
<constraint firstItem="FdH-8c-jAP" firstAttribute="centerY" secondItem="074-Lr-sTa" secondAttribute="centerY" id="SJP-Iu-Agm"/>
<constraint firstAttribute="trailing" secondItem="raq-XK-qhh" secondAttribute="trailing" id="Sr2-8l-I7Z"/>
<constraint firstAttribute="trailing" secondItem="FdH-8c-jAP" secondAttribute="trailing" constant="12" id="Vg4-Bv-qiW"/>
<constraint firstItem="nPz-Ym-vpk" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="WJN-ti-QhO"/>
<constraint firstAttribute="bottom" secondItem="nPz-Ym-vpk" secondAttribute="bottom" id="aif-M8-0Jh"/>
<constraint firstAttribute="bottom" secondItem="raq-XK-qhh" secondAttribute="bottom" id="eE2-ef-bWE"/>
<constraint firstAttribute="trailing" secondItem="GYb-S9-FB8" secondAttribute="trailing" id="mDi-oS-hhJ"/>
<constraint firstAttribute="trailing" secondItem="nPz-Ym-vpk" secondAttribute="trailing" id="nMO-wi-Ic7"/>
<constraint firstItem="raq-XK-qhh" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="qAp-bv-ObA"/>
<constraint firstAttribute="bottom" secondItem="074-Lr-sTa" secondAttribute="bottom" constant="10" id="wAO-bU-aoJ"/>
</constraints>
<size key="customSize" width="294" height="284"/>
<connections>
<outlet property="IDLabel" destination="074-Lr-sTa" id="e79-2B-vZT"/>
<outlet property="animateImageView" destination="T17-NM-Dxi" id="umd-Lq-85F"/>
<outlet property="countLabel" destination="BSc-rv-bf4" id="3DZ-sZ-CCV"/>
<outlet property="coverImageView" destination="nPz-Ym-vpk" id="3tk-L4-05N"/>
<outlet property="displayMaskView" destination="raq-XK-qhh" id="gYi-Af-gep"/>
<outlet property="nameLabel" destination="V8F-du-Rah" id="Ah9-Wd-QZJ"/>
<outlet property="roomTypeView" destination="GYb-S9-FB8" id="Tgr-f6-Qla"/>
</connections>
<point key="canvasLocation" x="323.66412213740455" y="102.11267605633803"/>
</collectionViewCell>
</objects>
<resources>
<image name="room_hot_icon" width="16" height="16"/>
</resources>
</document>

View File

@@ -0,0 +1,31 @@
//
// QXHomeTopCell.h
// QXLive
//
// Created by 启星 on 2025/5/7.
//
#import "GKCycleScrollViewCell.h"
#import "QXRoomListModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXHomeTopCell : GKCycleScrollViewCell
@property (nonatomic,strong)UIImageView *roomCoverImageView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIView *disPlayMaskView;
@property (nonatomic,strong)UIView *animateBgView;
@property (nonatomic,strong)UIImageView *animateView;
@property (nonatomic,strong)UIView *roomPeopleBgView;
@property (nonatomic,strong)UIImageView *roomPeopleBgImageView;
@property (nonatomic,strong)UIImageView *firstHeaderImageView;
@property (nonatomic,strong)UIImageView *secondHeaderImageView;
@property (nonatomic,strong)UIImageView *thirdHeaderImageView;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)QXRoomListModel *roomModel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,158 @@
//
// QXHomeTopCell.m
// QXLive
//
// Created by on 2025/5/7.
//
#import "QXHomeTopCell.h"
@interface QXHomeTopCell()
@property(nonatomic,strong)NSMutableArray *imgs;
@end
@implementation QXHomeTopCell
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
}
return self;
}
-(void)initSubViews{
self.backgroundColor = [UIColor clearColor];
self.roomCoverImageView = [[UIImageView alloc] init];
self.roomCoverImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.roomCoverImageView addRoundedCornersWithRadius:7];
self.roomCoverImageView.layer.borderColor = RGB16(0x333333).CGColor;
self.roomCoverImageView.layer.borderWidth = 1.5;
[self addSubview:self.roomCoverImageView];
self.disPlayMaskView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3, 91)];
[self.disPlayMaskView setTopToBottomGradientBackgroundWithColors:@[[UIColor colorWithHexString:@"#00000000"],[UIColor colorWithHexString:@"#00000096"]] frame:self.disPlayMaskView.bounds];
[self.disPlayMaskView addRoundedCornersWithRadius:7];
[self addSubview:self.disPlayMaskView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textColor = RGB16(0x333333);
self.titleLabel.font = [UIFont systemFontOfSize:12];
[self addSubview:self.titleLabel];
self.animateBgView = [[UIView alloc] init];
self.animateBgView.backgroundColor = RGB16(0x333333);
[self.animateBgView addRoundedCornersWithRadius:8];
[self addSubview:self.animateBgView];
self.animateView = [[UIImageView alloc] init];
self.animateView.animationImages = self.imgs;
self.animateView.animationDuration = 1;
[self.animateView startAnimating];
[self.animateBgView addSubview:self.animateView];
self.roomPeopleBgView = [[UIView alloc] init];
[self.roomPeopleBgView addRoundedCornersWithRadius:7];
[self addSubview:self.roomPeopleBgView];
self.roomPeopleBgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_top_room_people_bg"]];
self.roomPeopleBgImageView.contentMode = UIViewContentModeScaleToFill;
[self.roomPeopleBgView addSubview:self.roomPeopleBgImageView];
self.firstHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.firstHeaderImageView.backgroundColor = [UIColor whiteColor];
[self.firstHeaderImageView addRoundedCornersWithRadius:8];
self.firstHeaderImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.roomPeopleBgView addSubview:self.firstHeaderImageView];
self.secondHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.secondHeaderImageView.backgroundColor = [UIColor whiteColor];
[self.secondHeaderImageView addRoundedCornersWithRadius:8];
self.secondHeaderImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.roomPeopleBgView addSubview:self.secondHeaderImageView];
self.thirdHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.thirdHeaderImageView.contentMode = UIViewContentModeScaleAspectFill;
self.thirdHeaderImageView.backgroundColor = [UIColor whiteColor];
[self.thirdHeaderImageView addRoundedCornersWithRadius:8];
[self.roomPeopleBgView addSubview:self.thirdHeaderImageView];
self.countLabel = [[UILabel alloc] init];
[self.countLabel adjustsFontSizeToFitWidth];
self.countLabel.textAlignment = NSTextAlignmentCenter;
self.countLabel.font = [UIFont systemFontOfSize:12.f];
self.countLabel.textColor = UIColor.whiteColor;
[self.roomPeopleBgView addSubview:self.countLabel];
[self.roomCoverImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.equalTo(self);
make.height.mas_equalTo(91);
}];
[self.disPlayMaskView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.bottom.equalTo(self.roomCoverImageView);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.top.equalTo(self.roomCoverImageView.mas_bottom).offset(5);
}];
[self.animateBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.mas_equalTo(8);
make.size.mas_equalTo(CGSizeMake(28, 16));
}];
[self.animateView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(20, 12));
make.centerX.centerY.equalTo(self.animateBgView);
}];
[self.roomPeopleBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(0);
make.size.mas_equalTo(CGSizeMake(93, 24));
make.bottom.equalTo(self.roomCoverImageView.mas_bottom);
}];
[self.roomPeopleBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.right.left.equalTo(self.roomPeopleBgView);
}];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-5);
make.width.mas_equalTo(32);
make.height.mas_equalTo(12);
make.centerY.equalTo(self.roomPeopleBgView);
}];
[self.thirdHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(16, 16));
make.right.equalTo(self.countLabel.mas_left).offset(-5);
make.centerY.equalTo(self.roomPeopleBgView);
}];
[self.secondHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(16, 16));
make.right.equalTo(self.thirdHeaderImageView.mas_left).offset(6);
make.centerY.equalTo(self.roomPeopleBgView);
}];
[self.firstHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(16, 16));
make.right.equalTo(self.secondHeaderImageView.mas_left).offset(6);
make.centerY.equalTo(self.roomPeopleBgView);
}];
self.countLabel.text = @"23人";
}
-(void)setRoomModel:(QXRoomListModel *)roomModel{
_roomModel = roomModel;
self.titleLabel.text = roomModel.room_name;
[self.roomCoverImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_cover]];
self.countLabel.text = [NSString localizedStringWithFormat:QXText(@"%@人"),[NSString stringWithFormat:@"%ld",roomModel.user_list.count]];
for (int i = 0; i < roomModel.user_list.count; i++) {
QXUserHomeModel *md = roomModel.user_list[i];
if (i == 0) {
[self.thirdHeaderImageView sd_setImageWithURL:[NSURL URLWithString:md.avatar]];
}else if (i == 1){
[self.secondHeaderImageView sd_setImageWithURL:[NSURL URLWithString:md.avatar]];
}else{
[self.firstHeaderImageView sd_setImageWithURL:[NSURL URLWithString:md.avatar]];
}
}
}
-(NSMutableArray *)imgs{
if (!_imgs) {
_imgs = [NSMutableArray array];
for (int i = 0; i < 14; i++) {
NSString *str = [NSString stringWithFormat:@"Flow 100%02d",i];
UIImage *img = [UIImage imageNamed:str];
[_imgs addObject:img];
}
}
return _imgs;
}
@end

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -0,0 +1,34 @@
//
// QXMyRankView.h
// IsLandVoice
//
// Created by 启星 on 2025/3/4.
//
#import <UIKit/UIKit.h>
#import "QXRankModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXMyRankView : UIView
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
@property (weak, nonatomic) IBOutlet UILabel *nickNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *valueLabel;
@property (weak, nonatomic) IBOutlet UILabel *rankResultLabel;
@property (weak, nonatomic) IBOutlet UILabel *needLabel;
@property (weak, nonatomic) IBOutlet UIImageView *valueBGImageView;
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView1;
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView2;
@property (weak, nonatomic) IBOutlet UILabel *allNickNameLabel;
@property (weak, nonatomic) IBOutlet UIImageView *headerImageViewBG;
@property(nonatomic,assign)BOOL isCP;
@property (nonatomic,strong)QXMyRankModel *model;
@property (nonatomic,strong)QXMyRankModel *roomModel;
@property (nonatomic,strong)QXMyRankModel *guildModel;
@property (nonatomic,strong)QXMyRankModel *cpModel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,143 @@
//
// QXMyRankView.m
// IsLandVoice
//
// Created by on 2025/3/4.
//
#import "QXMyRankView.h"
@interface QXMyRankView()
{
CGRect tmpRect;
}
@end
@implementation QXMyRankView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self = [[[NSBundle mainBundle]loadNibNamed:@"QXMyRankView" owner:nil options:nil] lastObject];
tmpRect = frame;
self.frame = frame;
}
return self;
}
-(void)setIsCP:(BOOL)isCP{
_isCP = isCP;
self.headerImageView1.hidden = !isCP;
self.headerImageView2.hidden = !isCP;
self.allNickNameLabel.hidden = !isCP;
self.headerImageViewBG.hidden = !isCP;
self.headerImageView.hidden = isCP;
self.nickNameLabel.hidden = isCP;
self.valueLabel.hidden = isCP;
self.valueBGImageView.hidden = isCP;
}
-(void)setModel:(QXMyRankModel *)model{
_model = model;
self.nickNameLabel.text = model.nickname;
if (model.rank.intValue <= 0) {
self.rankResultLabel.text = @"暂未上榜";
}else{
NSString *s = [NSString stringWithFormat:@"第%@名",model.rank];
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:s];
[attr yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:NSMakeRange(1, model.rank.length)];
self.rankResultLabel.attributedText = attr;
}
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.valueLabel.text = model.total;
NSString *diff = model.diff;
NSString *s1 = [NSString stringWithFormat:@"距离上一名差%@",diff];
NSMutableAttributedString *attr1 = [[NSMutableAttributedString alloc] initWithString:s1];
[attr1 yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:NSMakeRange(6, diff.length)];
self.needLabel.attributedText = attr1;
}
-(void)setRoomModel:(QXMyRankModel *)roomModel{
_roomModel = roomModel;
self.nickNameLabel.text = roomModel.room_name;
if (roomModel.rank.intValue <= 0) {
self.rankResultLabel.text = @"暂未上榜";
}else{
NSString *s = [NSString stringWithFormat:@"第%@名",roomModel.rank];
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:s];
[attr yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:NSMakeRange(1, roomModel.rank.length)];
self.rankResultLabel.attributedText = attr;
}
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:roomModel.room_cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.valueLabel.text = roomModel.total;
NSString *diff = roomModel.diff;
NSString *s1 = [NSString stringWithFormat:@"距离上一名差%@",roomModel.diff];
NSMutableAttributedString *attr1 = [[NSMutableAttributedString alloc] initWithString:s1];
[attr1 yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:NSMakeRange(6, diff.length)];
self.needLabel.attributedText = attr1;
}
-(void)setGuildModel:(QXMyRankModel *)guildModel{
_guildModel = guildModel;
if (guildModel.guild_name.length>0) {
self.nickNameLabel.text = guildModel.guild_name;
}else{
self.nickNameLabel.text = @"暂无公会";
}
if (guildModel.rank.intValue <= 0) {
self.rankResultLabel.text = @"暂未上榜";
}else{
NSString *s = [NSString stringWithFormat:@"第%@名",guildModel.rank];
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:s];
[attr yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:NSMakeRange(1, guildModel.rank.length)];
self.rankResultLabel.attributedText = attr;
}
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:guildModel.cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.valueLabel.text = guildModel.total;
NSString *diff = guildModel.diff;
NSString *s1 = [NSString stringWithFormat:@"距离上一名差%@",guildModel.diff];
NSMutableAttributedString *attr1 = [[NSMutableAttributedString alloc] initWithString:s1];
[attr1 yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:NSMakeRange(6, diff.length)];
self.needLabel.attributedText = attr1;
}
//
-(void)setCpModel:(QXMyRankModel *)cpModel{
_cpModel = cpModel;
if (cpModel.nickname1.length == 0 || cpModel== nil) {
// self.allNickNameLabel.text = [NSString stringWithFormat:@"%@",cpModel.nickname];
self.allNickNameLabel.text = [NSString stringWithFormat:@"%@",QXGlobal.shareGlobal.loginModel.nickname];
[self.headerImageView1 sd_setImageWithURL:[NSURL URLWithString:QXGlobal.shareGlobal.loginModel.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.needLabel.text = @"-";
}else{
self.allNickNameLabel.text = [NSString stringWithFormat:@"%@\n%@",cpModel.nickname,cpModel.nickname1];
[self.headerImageView1 sd_setImageWithURL:[NSURL URLWithString:cpModel.user_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
[self.headerImageView2 sd_setImageWithURL:[NSURL URLWithString:cpModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
NSString *diff = cpModel.diff;
NSString *s1 = [NSString stringWithFormat:@"距离上一名差%@",cpModel.diff];
NSMutableAttributedString *attr1 = [[NSMutableAttributedString alloc] initWithString:s1];
[attr1 yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:NSMakeRange(6, diff.length)];
self.needLabel.attributedText = attr1;
}
if (cpModel.rank.intValue <= 0) {
self.rankResultLabel.text = @"暂未上榜";
}else{
NSString *s = [NSString stringWithFormat:@"第%@名",cpModel.rank];
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:s];
[attr yy_setColor:[UIColor colorWithHexString:@"#FF8ACC"] range:NSMakeRange(1, cpModel.rank.length)];
self.rankResultLabel.attributedText = attr;
}
}
-(void)layoutSubviews{
[super layoutSubviews];
self.frame = tmpRect;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end

View File

@@ -0,0 +1,162 @@
<?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" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="System colors in document resources" minToolsVersion="11.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"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="QXMyRankView">
<rect key="frame" x="0.0" y="0.0" width="408" height="60"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="my_rank_bg" translatesAutoresizingMaskIntoConstraints="NO" id="ePb-yj-J0N">
<rect key="frame" x="16" y="0.0" width="376" height="60"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="vLt-zu-0Mv">
<rect key="frame" x="56" y="12.666666666666664" width="35" height="35"/>
<constraints>
<constraint firstAttribute="width" constant="35" id="9ZR-5q-S9k"/>
<constraint firstAttribute="height" constant="35" id="f46-t6-Byz"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="17.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="我的昵称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EWO-Iu-HUp">
<rect key="frame" x="101" y="6.6666666666666679" width="51.666666666666657" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="暂未上榜" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Uow-ZO-SrA">
<rect key="frame" x="300.33333333333331" y="6.666666666666667" width="51.666666666666686" height="15.666666666666664"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="距离上榜差50" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nlo-j2-wvh">
<rect key="frame" x="269.66666666666669" y="36.333333333333336" width="82.333333333333314" height="15.666666666666664"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="my_rank_value_bg" translatesAutoresizingMaskIntoConstraints="NO" id="Wyj-Op-wbc">
<rect key="frame" x="101" y="35.666666666666664" width="80" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="0gn-CS-aaa"/>
<constraint firstAttribute="height" constant="17" id="qwh-GR-5C6"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JHc-0B-ehZ">
<rect key="frame" x="121" y="33.666666666666664" width="50" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="9JK-sq-aEm"/>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="50" id="TGV-kn-GoQ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="gJ7-Yb-gZ2">
<rect key="frame" x="56" y="15" width="30" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="EgB-Jp-opH"/>
<constraint firstAttribute="width" constant="30" id="HzL-Mh-zxc"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="HyS-dG-hw0">
<rect key="frame" x="86" y="15" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="Z9M-Lo-cGv"/>
<constraint firstAttribute="height" constant="30" id="mfF-fJ-KoI"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="my_real_love_bg" translatesAutoresizingMaskIntoConstraints="NO" id="EkQ-iX-tic">
<rect key="frame" x="56" y="15" width="60" height="30"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="我的昵称" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fUo-Tv-Mau">
<rect key="frame" x="126.00000000000001" y="22.333333333333332" width="51.666666666666671" height="15.666666666666668"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="vLt-zu-0Mv" firstAttribute="top" secondItem="EWO-Iu-HUp" secondAttribute="bottom" constant="-10" id="1NF-b5-nfv"/>
<constraint firstAttribute="bottom" secondItem="ePb-yj-J0N" secondAttribute="bottom" id="2ez-kJ-oMa"/>
<constraint firstItem="Wyj-Op-wbc" firstAttribute="leading" secondItem="vLt-zu-0Mv" secondAttribute="trailing" constant="10" id="5Bd-P6-sfC"/>
<constraint firstItem="fUo-Tv-Mau" firstAttribute="centerY" secondItem="EkQ-iX-tic" secondAttribute="centerY" id="5Oq-oZ-Oxc"/>
<constraint firstItem="gJ7-Yb-gZ2" firstAttribute="centerY" secondItem="EkQ-iX-tic" secondAttribute="centerY" id="7D0-2f-HJ3"/>
<constraint firstAttribute="trailing" secondItem="ePb-yj-J0N" secondAttribute="trailing" constant="16" id="9lv-Pb-add"/>
<constraint firstItem="ePb-yj-J0N" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="9qN-t8-IOK"/>
<constraint firstItem="Uow-ZO-SrA" firstAttribute="trailing" secondItem="ePb-yj-J0N" secondAttribute="trailing" constant="-40" id="AZi-2y-FnI"/>
<constraint firstItem="ePb-yj-J0N" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="Ecs-gP-sBp"/>
<constraint firstItem="fUo-Tv-Mau" firstAttribute="leading" secondItem="EkQ-iX-tic" secondAttribute="trailing" constant="10" id="GGy-WQ-4Cv"/>
<constraint firstItem="gJ7-Yb-gZ2" firstAttribute="leading" secondItem="EkQ-iX-tic" secondAttribute="leading" id="GRK-mL-cZO"/>
<constraint firstItem="nlo-j2-wvh" firstAttribute="trailing" secondItem="Uow-ZO-SrA" secondAttribute="trailing" id="J8p-E3-fdD"/>
<constraint firstItem="HyS-dG-hw0" firstAttribute="centerY" secondItem="EkQ-iX-tic" secondAttribute="centerY" id="LRG-fZ-XWX"/>
<constraint firstItem="EWO-Iu-HUp" firstAttribute="leading" secondItem="vLt-zu-0Mv" secondAttribute="trailing" constant="10" id="MeF-57-8oP"/>
<constraint firstItem="EkQ-iX-tic" firstAttribute="centerY" secondItem="ePb-yj-J0N" secondAttribute="centerY" id="MpR-7z-Dm1"/>
<constraint firstItem="vLt-zu-0Mv" firstAttribute="leading" secondItem="ePb-yj-J0N" secondAttribute="leading" constant="40" id="QiJ-a5-bQ5"/>
<constraint firstItem="Wyj-Op-wbc" firstAttribute="top" secondItem="vLt-zu-0Mv" secondAttribute="bottom" constant="-12" id="WiT-Ey-ySS"/>
<constraint firstItem="JHc-0B-ehZ" firstAttribute="centerY" secondItem="Wyj-Op-wbc" secondAttribute="centerY" constant="-2" id="X1b-hB-RuL"/>
<constraint firstItem="EkQ-iX-tic" firstAttribute="leading" secondItem="vLt-zu-0Mv" secondAttribute="leading" id="dnZ-Np-Wls"/>
<constraint firstItem="nlo-j2-wvh" firstAttribute="centerY" secondItem="Wyj-Op-wbc" secondAttribute="centerY" id="fec-C6-XSj"/>
<constraint firstItem="HyS-dG-hw0" firstAttribute="trailing" secondItem="EkQ-iX-tic" secondAttribute="trailing" id="h9A-UL-yEO"/>
<constraint firstItem="JHc-0B-ehZ" firstAttribute="leading" secondItem="Wyj-Op-wbc" secondAttribute="trailing" constant="-60" id="ot7-bi-rID"/>
<constraint firstItem="vLt-zu-0Mv" firstAttribute="centerY" secondItem="ePb-yj-J0N" secondAttribute="centerY" id="uGa-zk-S0C"/>
<constraint firstItem="Uow-ZO-SrA" firstAttribute="centerY" secondItem="EWO-Iu-HUp" secondAttribute="centerY" id="vBz-ca-Ljt"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="allNickNameLabel" destination="fUo-Tv-Mau" id="GlN-lE-r94"/>
<outlet property="headerImageView" destination="vLt-zu-0Mv" id="xJO-0N-aRk"/>
<outlet property="headerImageView1" destination="gJ7-Yb-gZ2" id="npX-TO-x84"/>
<outlet property="headerImageView2" destination="HyS-dG-hw0" id="564-gi-7YC"/>
<outlet property="headerImageViewBG" destination="EkQ-iX-tic" id="QzQ-tu-Uo1"/>
<outlet property="needLabel" destination="nlo-j2-wvh" id="xPu-8V-gxg"/>
<outlet property="nickNameLabel" destination="EWO-Iu-HUp" id="Qgf-l4-BE4"/>
<outlet property="rankResultLabel" destination="Uow-ZO-SrA" id="mWr-iL-94L"/>
<outlet property="valueBGImageView" destination="Wyj-Op-wbc" id="gAJ-Fl-hIx"/>
<outlet property="valueLabel" destination="JHc-0B-ehZ" id="NXA-0r-kSz"/>
</connections>
<point key="canvasLocation" x="54.961832061068698" y="8.4507042253521139"/>
</view>
</objects>
<resources>
<image name="my_rank_bg" width="343" height="62"/>
<image name="my_rank_value_bg" width="43" height="17"/>
<image name="my_real_love_bg" width="60" height="30"/>
<image name="user_header_placehoulder" width="40" height="40"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -0,0 +1,23 @@
//
// QXRankCPListCell.h
// IsLandVoice
//
// Created by 启星 on 2025/3/4.
//
#import <UIKit/UIKit.h>
//#import "SRRankListResponse.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRankCPListCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView1;
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView2;
@property (weak, nonatomic) IBOutlet UILabel *valueLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
//@property (nonatomic,strong)SRRankListResponseModel *model;
+(instancetype)cellWithTableView:(UITableView *)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,38 @@
//
// QXRankCPListCell.m
// IsLandVoice
//
// Created by on 2025/3/4.
//
#import "QXRankCPListCell.h"
@implementation QXRankCPListCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXRankCPListCell";
QXRankCPListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
}
return cell;
}
//-(void)setModel:(SRRankListResponseModel *)model{
// _model = model;
// [self.headerImageView1 sd_setImageWithURL:[NSURL URLWithString:model.head_picture1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
// [self.headerImageView2 sd_setImageWithURL:[NSURL URLWithString:model.head_picture2] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
// self.nameLabel.text = [NSString stringWithFormat:@"%@\n%@",model.nickname1,model.nickname2];
// self.valueLabel.text = model.number;
// self.numberLabel.text = model.rank;
//}
- (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

View File

@@ -0,0 +1,122 @@
<?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>
<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="default" indentationWidth="10" rowHeight="132" id="KGk-i7-Jjw" customClass="QXRankCPListCell">
<rect key="frame" x="0.0" y="0.0" width="574" height="132"/>
<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="574" height="132"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BeV-U5-bqr">
<rect key="frame" x="16" y="57.666666666666657" width="30" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="h6P-AH-kzH"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="8nl-Wf-Mmq">
<rect key="frame" x="56" y="51" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="76g-jc-5fs"/>
<constraint firstAttribute="height" constant="30" id="Q8C-ug-bGh"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="Tzo-q6-iXL">
<rect key="frame" x="86" y="51" width="30" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="Xau-Zt-JhU"/>
<constraint firstAttribute="width" constant="30" id="xJm-En-LYo"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Group 7018" translatesAutoresizingMaskIntoConstraints="NO" id="gXN-qt-239">
<rect key="frame" x="56" y="51" width="60" height="30"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="33" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TlQ-z7-ShX">
<rect key="frame" x="503" y="57.666666666666657" width="55" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="55" id="sNf-Qe-nxg"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Vector" translatesAutoresizingMaskIntoConstraints="NO" id="BVp-92-65o">
<rect key="frame" x="473" y="56" width="20" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="Bp3-AN-p7l"/>
<constraint firstAttribute="height" constant="20" id="g7q-UD-YrY"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zuj-eZ-aW5">
<rect key="frame" x="132" y="57.666666666666657" width="200" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="qsT-0P-Czq"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="BeV-U5-bqr" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="4M3-5B-OAx"/>
<constraint firstItem="TlQ-z7-ShX" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="BD1-yo-zhe"/>
<constraint firstItem="8nl-Wf-Mmq" firstAttribute="centerY" secondItem="gXN-qt-239" secondAttribute="centerY" id="Ckp-yY-L3M"/>
<constraint firstAttribute="trailing" secondItem="TlQ-z7-ShX" secondAttribute="trailing" constant="16" id="FXb-rb-XhL"/>
<constraint firstItem="BVp-92-65o" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="JYH-MG-9z5"/>
<constraint firstItem="zuj-eZ-aW5" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="Qu6-8Y-86z"/>
<constraint firstItem="gXN-qt-239" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="WLC-cw-VZE"/>
<constraint firstItem="BeV-U5-bqr" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="aU8-C2-YB9"/>
<constraint firstItem="gXN-qt-239" firstAttribute="leading" secondItem="BeV-U5-bqr" secondAttribute="trailing" constant="10" id="brH-hr-L3t"/>
<constraint firstItem="Tzo-q6-iXL" firstAttribute="centerY" secondItem="gXN-qt-239" secondAttribute="centerY" id="h5Q-tj-sbt"/>
<constraint firstItem="zuj-eZ-aW5" firstAttribute="leading" secondItem="Tzo-q6-iXL" secondAttribute="trailing" constant="16" id="j7g-oT-suR"/>
<constraint firstItem="8nl-Wf-Mmq" firstAttribute="leading" secondItem="gXN-qt-239" secondAttribute="leading" id="jSg-tu-5dg"/>
<constraint firstItem="Tzo-q6-iXL" firstAttribute="trailing" secondItem="gXN-qt-239" secondAttribute="trailing" id="oK3-Qu-IPm"/>
<constraint firstItem="TlQ-z7-ShX" firstAttribute="leading" secondItem="BVp-92-65o" secondAttribute="trailing" constant="10" id="uB6-WK-EBJ"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="headerImageView1" destination="8nl-Wf-Mmq" id="PFH-Lb-GOZ"/>
<outlet property="headerImageView2" destination="Tzo-q6-iXL" id="3Rl-Ah-vhL"/>
<outlet property="nameLabel" destination="zuj-eZ-aW5" id="hWV-Rr-alr"/>
<outlet property="numberLabel" destination="BeV-U5-bqr" id="xWa-Tn-RmZ"/>
<outlet property="valueLabel" destination="TlQ-z7-ShX" id="iHB-8v-hLR"/>
</connections>
<point key="canvasLocation" x="332.82442748091603" y="50.70422535211268"/>
</tableViewCell>
</objects>
<resources>
<image name="Group 7018" width="60" height="30"/>
<image name="Vector" width="14" height="14"/>
<image name="user_header_placehoulder" width="128" height="128"/>
</resources>
</document>

View File

@@ -0,0 +1,34 @@
//
// QXRankCPTopThreeView.h
// IsLandVoice
//
// Created by 启星 on 2025/3/4.
//
#import <UIKit/UIKit.h>
#import "QXRankModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRankCPTopThreeView : UIView
@property (weak, nonatomic) IBOutlet UIImageView *firstHeaderImage;
@property (weak, nonatomic) IBOutlet UIImageView *firstHeaderImage2;
@property (weak, nonatomic) IBOutlet UILabel *firstNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *firstIDLabel;
@property (weak, nonatomic) IBOutlet UILabel *firstRankValueLabel;
@property (weak, nonatomic) IBOutlet UIImageView *secondHeaderImage;
@property (weak, nonatomic) IBOutlet UIImageView *secondHeaderImage2;
@property (weak, nonatomic) IBOutlet UILabel *secondNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *secondIDLabel;
@property (weak, nonatomic) IBOutlet UILabel *secondRankValueLabel;
@property (weak, nonatomic) IBOutlet UIImageView *thirdHeaderImage;
@property (weak, nonatomic) IBOutlet UIImageView *thirdHeaderImage2;
@property (weak, nonatomic) IBOutlet UILabel *thirdNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *thirdIDLabel;
@property (weak, nonatomic) IBOutlet UILabel *thirdRankValueLabel;
-(void)resetView;
@property (nonatomic,strong)NSArray<QXMyRankModel*>*list;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,78 @@
//
// QXRankCPTopThreeView.m
// IsLandVoice
//
// Created by on 2025/3/4.
//
#import "QXRankCPTopThreeView.h"
@implementation QXRankCPTopThreeView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self = [[[NSBundle mainBundle]loadNibNamed:@"QXRankCPTopThreeView" owner:nil options:nil] lastObject];
self.frame = frame;
}
return self;
}
-(void)resetView{
self.firstHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.firstHeaderImage2.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.secondHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.secondHeaderImage2.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.thirdHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.secondHeaderImage2.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.firstNameLabel.text = @"虚位以待";
self.secondNameLabel.text = @"虚位以待";
self.thirdNameLabel.text = @"虚位以待";
self.firstIDLabel.text = @"虚位以待";
self.secondIDLabel.text = @"虚位以待";
self.thirdIDLabel.text = @"虚位以待";
}
-(void)setList:(NSArray<QXMyRankModel *> *)list{
QXMyRankModel *firstModel;
QXMyRankModel *secondModel;
QXMyRankModel *thirdModel;
if (list.count >= 3) {
firstModel = list[0];
secondModel = list[1];
thirdModel = list[2];
}
if (list.count == 2) {
firstModel = list[0];
secondModel = list[1];
}
if (list.count == 1) {
firstModel = list[0];
}
if (firstModel) {
[self.firstHeaderImage sd_setImageWithURL:[NSURL URLWithString:firstModel.user_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
[self.firstHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:firstModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.firstNameLabel.text = firstModel.nickname;
self.firstIDLabel.text = firstModel.nickname1;
self.firstRankValueLabel.text = firstModel.total;
}
if (secondModel) {
[self.secondHeaderImage sd_setImageWithURL:[NSURL URLWithString:secondModel.user_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
[self.secondHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:secondModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.secondNameLabel.text = secondModel.nickname;
self.secondIDLabel.text = secondModel.nickname1;
self.secondRankValueLabel.text = secondModel.total;
}
if (thirdModel) {
[self.thirdHeaderImage sd_setImageWithURL:[NSURL URLWithString:thirdModel.user_avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
[self.thirdHeaderImage2 sd_setImageWithURL:[NSURL URLWithString:thirdModel.user_avatar1] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.thirdNameLabel.text = thirdModel.nickname;
self.thirdIDLabel.text = thirdModel.nickname1;
self.thirdRankValueLabel.text = thirdModel.total;
}
}
@end

View File

@@ -0,0 +1,380 @@
<?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" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<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"/>
<view contentMode="scaleToFill" id="WH3-Kj-tPl" userLabel="RankCP Top Three View" customClass="QXRankCPTopThreeView">
<rect key="frame" x="0.0" y="0.0" width="438" height="230"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fkt-5i-wGo">
<rect key="frame" x="16.000000000000007" y="30" width="126.66666666666669" height="190"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_second_bg" translatesAutoresizingMaskIntoConstraints="NO" id="Iug-6G-0qC">
<rect key="frame" x="0.0" y="30" width="126.66666666666667" height="150"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="gQo-o1-sqd"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="TYB-N3-5Cs">
<rect key="frame" x="15.333333333333329" y="12.666666666666664" width="45" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="VXe-ml-VYq"/>
<constraint firstAttribute="width" constant="45" id="rjf-AN-Hla"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="22.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="Uue-tQ-gRt">
<rect key="frame" x="66.333333333333329" y="12.666666666666664" width="45" height="45"/>
<constraints>
<constraint firstAttribute="width" constant="45" id="G4Y-CK-nNz"/>
<constraint firstAttribute="height" constant="45" id="Nlc-TP-CLE"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="22.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_real_love_second_header" translatesAutoresizingMaskIntoConstraints="NO" id="Bcx-vW-3yy">
<rect key="frame" x="8.3333333333333286" y="0.0" width="110" height="70"/>
<constraints>
<constraint firstAttribute="height" constant="70" id="A1C-5f-uA2"/>
<constraint firstAttribute="width" constant="110" id="iXo-3I-ff5"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TOP 2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="K2f-Fr-81A">
<rect key="frame" x="0.0" y="75" width="126.66666666666667" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="hB1-Ix-7ZD"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="17"/>
<color key="textColor" red="0.27058823529999998" green="0.52549019610000003" blue="0.86666666670000003" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ckM-s4-iVh">
<rect key="frame" x="0.0" y="102" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JgV-Ob-RU0">
<rect key="frame" x="0.0" y="122" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_real_love_value_bg" translatesAutoresizingMaskIntoConstraints="NO" id="Ub0-eH-9eE">
<rect key="frame" x="21" y="150" width="85" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="XvT-C9-MnK"/>
<constraint firstAttribute="width" constant="85" id="n7G-4G-8KW"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hGy-Aa-hUg">
<rect key="frame" x="41" y="149.66666666666666" width="60" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="7YG-gw-rwJ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="JgV-Ob-RU0" firstAttribute="trailing" secondItem="Iug-6G-0qC" secondAttribute="trailing" id="1Og-TM-wT2"/>
<constraint firstItem="ckM-s4-iVh" firstAttribute="trailing" secondItem="Iug-6G-0qC" secondAttribute="trailing" id="4Sx-mg-E3i"/>
<constraint firstAttribute="height" constant="190" id="ABA-Y3-oCb"/>
<constraint firstItem="hGy-Aa-hUg" firstAttribute="leading" secondItem="Ub0-eH-9eE" secondAttribute="leading" constant="20" id="CR1-VP-mLr"/>
<constraint firstItem="K2f-Fr-81A" firstAttribute="trailing" secondItem="Iug-6G-0qC" secondAttribute="trailing" id="GUo-Kg-Ugg"/>
<constraint firstItem="Bcx-vW-3yy" firstAttribute="top" secondItem="Iug-6G-0qC" secondAttribute="top" constant="-30" id="K3K-I7-Mse"/>
<constraint firstItem="K2f-Fr-81A" firstAttribute="top" secondItem="Bcx-vW-3yy" secondAttribute="bottom" constant="5" id="OOK-uW-dSc"/>
<constraint firstItem="ckM-s4-iVh" firstAttribute="top" secondItem="K2f-Fr-81A" secondAttribute="bottom" constant="2" id="UWZ-MX-AEP"/>
<constraint firstItem="Uue-tQ-gRt" firstAttribute="centerY" secondItem="Bcx-vW-3yy" secondAttribute="centerY" id="XSK-F2-qmZ"/>
<constraint firstItem="hGy-Aa-hUg" firstAttribute="trailing" secondItem="Ub0-eH-9eE" secondAttribute="trailing" constant="-5" id="XYd-S9-Ss1"/>
<constraint firstItem="K2f-Fr-81A" firstAttribute="leading" secondItem="Iug-6G-0qC" secondAttribute="leading" id="dJB-al-53x"/>
<constraint firstItem="JgV-Ob-RU0" firstAttribute="top" secondItem="ckM-s4-iVh" secondAttribute="bottom" constant="3" id="eQc-Lv-ulO"/>
<constraint firstItem="Bcx-vW-3yy" firstAttribute="centerX" secondItem="Iug-6G-0qC" secondAttribute="centerX" id="faz-Hl-edq"/>
<constraint firstItem="ckM-s4-iVh" firstAttribute="leading" secondItem="Iug-6G-0qC" secondAttribute="leading" id="gX7-PV-ozC"/>
<constraint firstItem="TYB-N3-5Cs" firstAttribute="centerY" secondItem="Bcx-vW-3yy" secondAttribute="centerY" id="hkb-ID-ZKF"/>
<constraint firstItem="Ub0-eH-9eE" firstAttribute="centerX" secondItem="Iug-6G-0qC" secondAttribute="centerX" id="iUQ-2w-Hfa"/>
<constraint firstItem="Ub0-eH-9eE" firstAttribute="bottom" secondItem="Iug-6G-0qC" secondAttribute="bottom" constant="-10" id="k6x-oF-iTh"/>
<constraint firstItem="JgV-Ob-RU0" firstAttribute="leading" secondItem="Iug-6G-0qC" secondAttribute="leading" id="kKd-6b-cDc"/>
<constraint firstItem="TYB-N3-5Cs" firstAttribute="leading" secondItem="Bcx-vW-3yy" secondAttribute="leading" constant="7" id="kwC-r0-riC"/>
<constraint firstAttribute="trailing" secondItem="Iug-6G-0qC" secondAttribute="trailing" id="l0a-kH-9cz"/>
<constraint firstAttribute="bottom" secondItem="Iug-6G-0qC" secondAttribute="bottom" constant="10" id="ln3-d3-UhK"/>
<constraint firstItem="Uue-tQ-gRt" firstAttribute="trailing" secondItem="Bcx-vW-3yy" secondAttribute="trailing" constant="-7" id="sxx-Qn-Ueb"/>
<constraint firstItem="hGy-Aa-hUg" firstAttribute="centerY" secondItem="Ub0-eH-9eE" secondAttribute="centerY" id="txo-0u-d1T"/>
<constraint firstItem="Iug-6G-0qC" firstAttribute="leading" secondItem="fkt-5i-wGo" secondAttribute="leading" id="wQu-oQ-weZ"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9kQ-2p-WMi">
<rect key="frame" x="155.66666666666666" y="10" width="126.66666666666666" height="190"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_first_bg" translatesAutoresizingMaskIntoConstraints="NO" id="ELT-qa-QKO">
<rect key="frame" x="0.0" y="30" width="126.66666666666667" height="150"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="YhW-oT-Z6e"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="aGF-cs-ovJ">
<rect key="frame" x="15.333333333333343" y="12.666666666666671" width="45" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="8ni-RR-NlK"/>
<constraint firstAttribute="width" constant="45" id="GMo-sX-7vO"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="22.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="hOp-Tb-y2w">
<rect key="frame" x="66.333333333333343" y="12.666666666666671" width="45" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="DOF-IB-M0H"/>
<constraint firstAttribute="width" constant="45" id="lVk-tl-f4v"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="22.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_real_love_first_header" translatesAutoresizingMaskIntoConstraints="NO" id="TNm-GF-bzb">
<rect key="frame" x="8.3333333333333428" y="0.0" width="110" height="70"/>
<constraints>
<constraint firstAttribute="width" constant="110" id="lhO-rb-C9j"/>
<constraint firstAttribute="height" constant="70" id="nVg-Kn-hbw"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TOP 1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nkC-Y0-Yh2">
<rect key="frame" x="0.0" y="75" width="126.66666666666667" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="bMg-wC-0ft"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="17"/>
<color key="textColor" red="0.84313725490000002" green="0.30196078430000001" blue="0.17254901959999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tww-5a-ZSt">
<rect key="frame" x="0.0" y="102" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Is5-JJ-W6T">
<rect key="frame" x="0.0" y="122" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_real_love_value_bg" translatesAutoresizingMaskIntoConstraints="NO" id="PqR-bx-jVl">
<rect key="frame" x="21" y="150" width="85" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="85" id="hg1-6a-sS7"/>
<constraint firstAttribute="height" constant="20" id="zlM-wn-im8"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z7f-CG-uOk">
<rect key="frame" x="41" y="149.66666666666666" width="60" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="zIF-Xs-nJZ"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="TNm-GF-bzb" firstAttribute="centerX" secondItem="ELT-qa-QKO" secondAttribute="centerX" id="3lA-4h-ICt"/>
<constraint firstItem="Tww-5a-ZSt" firstAttribute="leading" secondItem="ELT-qa-QKO" secondAttribute="leading" id="9SJ-zE-Zof"/>
<constraint firstItem="Z7f-CG-uOk" firstAttribute="centerY" secondItem="PqR-bx-jVl" secondAttribute="centerY" id="9hN-IO-phN"/>
<constraint firstItem="TNm-GF-bzb" firstAttribute="top" secondItem="ELT-qa-QKO" secondAttribute="top" constant="-30" id="BMQ-CI-bxW"/>
<constraint firstItem="nkC-Y0-Yh2" firstAttribute="top" secondItem="TNm-GF-bzb" secondAttribute="bottom" constant="5" id="CWj-Yb-D1a"/>
<constraint firstAttribute="trailing" secondItem="ELT-qa-QKO" secondAttribute="trailing" id="Cog-Qb-Mox"/>
<constraint firstItem="nkC-Y0-Yh2" firstAttribute="leading" secondItem="ELT-qa-QKO" secondAttribute="leading" id="Ex4-aF-JNz"/>
<constraint firstItem="Is5-JJ-W6T" firstAttribute="top" secondItem="Tww-5a-ZSt" secondAttribute="bottom" constant="3" id="FOy-cZ-MXS"/>
<constraint firstItem="Z7f-CG-uOk" firstAttribute="leading" secondItem="PqR-bx-jVl" secondAttribute="leading" constant="20" id="NvH-oE-6jV"/>
<constraint firstItem="aGF-cs-ovJ" firstAttribute="centerY" secondItem="TNm-GF-bzb" secondAttribute="centerY" id="OCy-jI-csN"/>
<constraint firstAttribute="height" constant="190" id="QOM-MI-gTQ"/>
<constraint firstItem="Is5-JJ-W6T" firstAttribute="leading" secondItem="ELT-qa-QKO" secondAttribute="leading" id="Rho-aP-c0C"/>
<constraint firstItem="Is5-JJ-W6T" firstAttribute="trailing" secondItem="ELT-qa-QKO" secondAttribute="trailing" id="Rnf-8P-Z4u"/>
<constraint firstItem="hOp-Tb-y2w" firstAttribute="centerY" secondItem="TNm-GF-bzb" secondAttribute="centerY" id="TGJ-LC-B46"/>
<constraint firstAttribute="bottom" secondItem="ELT-qa-QKO" secondAttribute="bottom" constant="10" id="UIG-Xk-5Qi"/>
<constraint firstItem="hOp-Tb-y2w" firstAttribute="trailing" secondItem="TNm-GF-bzb" secondAttribute="trailing" constant="-7" id="UYt-7H-9zM"/>
<constraint firstItem="Tww-5a-ZSt" firstAttribute="trailing" secondItem="ELT-qa-QKO" secondAttribute="trailing" id="Zhi-MT-iil"/>
<constraint firstItem="ELT-qa-QKO" firstAttribute="leading" secondItem="9kQ-2p-WMi" secondAttribute="leading" id="bJd-Y2-qtw"/>
<constraint firstItem="PqR-bx-jVl" firstAttribute="bottom" secondItem="ELT-qa-QKO" secondAttribute="bottom" constant="-10" id="ntf-em-pv2"/>
<constraint firstItem="Tww-5a-ZSt" firstAttribute="top" secondItem="nkC-Y0-Yh2" secondAttribute="bottom" constant="2" id="r1Q-uw-MqZ"/>
<constraint firstItem="aGF-cs-ovJ" firstAttribute="leading" secondItem="TNm-GF-bzb" secondAttribute="leading" constant="7" id="sv8-uW-tJM"/>
<constraint firstItem="nkC-Y0-Yh2" firstAttribute="trailing" secondItem="ELT-qa-QKO" secondAttribute="trailing" id="vH7-h0-pFA"/>
<constraint firstItem="Z7f-CG-uOk" firstAttribute="trailing" secondItem="PqR-bx-jVl" secondAttribute="trailing" constant="-5" id="vk5-8p-bCe"/>
<constraint firstItem="PqR-bx-jVl" firstAttribute="centerX" secondItem="ELT-qa-QKO" secondAttribute="centerX" id="wQI-7G-gMv"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="W20-Fx-QTq">
<rect key="frame" x="295.33333333333331" y="30" width="126.66666666666669" height="190"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_third_bg" translatesAutoresizingMaskIntoConstraints="NO" id="Nxb-5v-S7f">
<rect key="frame" x="0.0" y="30" width="126.66666666666667" height="150"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="2f8-Mc-yvp"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="oRz-z8-zG5">
<rect key="frame" x="15.333333333333371" y="12.666666666666664" width="45" height="45"/>
<constraints>
<constraint firstAttribute="width" constant="45" id="9a8-Ar-pKG"/>
<constraint firstAttribute="height" constant="45" id="DTn-rb-qVy"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="22.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="jh5-rY-O8T">
<rect key="frame" x="66.333333333333371" y="12.666666666666664" width="45" height="45"/>
<constraints>
<constraint firstAttribute="height" constant="45" id="MyX-to-3tp"/>
<constraint firstAttribute="width" constant="45" id="mKt-rL-jxv"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="22.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_real_love_third_header" translatesAutoresizingMaskIntoConstraints="NO" id="ldL-jE-OCW">
<rect key="frame" x="8.3333333333333712" y="0.0" width="110" height="70"/>
<constraints>
<constraint firstAttribute="width" constant="110" id="ABy-co-Dux"/>
<constraint firstAttribute="height" constant="70" id="f9k-Tq-EBl"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TOP 3" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pyq-Of-sab">
<rect key="frame" x="0.0" y="75" width="126.66666666666667" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="rKG-1s-DvO"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="17"/>
<color key="textColor" red="0.89019607840000003" green="0.56475246349999997" blue="0.27059417520000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LeW-ad-gVJ">
<rect key="frame" x="0.0" y="102" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pwN-H0-3qj">
<rect key="frame" x="0.0" y="122" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_real_love_value_bg" translatesAutoresizingMaskIntoConstraints="NO" id="yOy-fE-ehe">
<rect key="frame" x="21" y="150" width="85" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="85" id="8zE-Ah-uVf"/>
<constraint firstAttribute="height" constant="20" id="val-a1-2fa"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6bp-EP-4mI">
<rect key="frame" x="41" y="149.66666666666666" width="60" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="KAx-jQ-OIw"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="Nxb-5v-S7f" secondAttribute="bottom" constant="10" id="1KP-S0-L4F"/>
<constraint firstItem="pyq-Of-sab" firstAttribute="leading" secondItem="Nxb-5v-S7f" secondAttribute="leading" id="484-d3-FPb"/>
<constraint firstItem="oRz-z8-zG5" firstAttribute="centerY" secondItem="ldL-jE-OCW" secondAttribute="centerY" id="4vl-6S-cPy"/>
<constraint firstItem="pwN-H0-3qj" firstAttribute="top" secondItem="LeW-ad-gVJ" secondAttribute="bottom" constant="3" id="7q3-5c-5vz"/>
<constraint firstItem="jh5-rY-O8T" firstAttribute="centerY" secondItem="ldL-jE-OCW" secondAttribute="centerY" id="9JG-sK-Gp2"/>
<constraint firstItem="pyq-Of-sab" firstAttribute="top" secondItem="ldL-jE-OCW" secondAttribute="bottom" constant="5" id="DNp-zR-glt"/>
<constraint firstItem="jh5-rY-O8T" firstAttribute="trailing" secondItem="ldL-jE-OCW" secondAttribute="trailing" constant="-7" id="EOt-kV-qy1"/>
<constraint firstAttribute="height" constant="190" id="GGW-5y-iuq"/>
<constraint firstItem="yOy-fE-ehe" firstAttribute="bottom" secondItem="Nxb-5v-S7f" secondAttribute="bottom" constant="-10" id="MLx-IV-G4l"/>
<constraint firstItem="6bp-EP-4mI" firstAttribute="leading" secondItem="yOy-fE-ehe" secondAttribute="leading" constant="20" id="PU3-oT-9KE"/>
<constraint firstItem="pyq-Of-sab" firstAttribute="trailing" secondItem="Nxb-5v-S7f" secondAttribute="trailing" id="R0k-da-muF"/>
<constraint firstItem="LeW-ad-gVJ" firstAttribute="top" secondItem="pyq-Of-sab" secondAttribute="bottom" constant="2" id="SFL-YD-CpX"/>
<constraint firstItem="pwN-H0-3qj" firstAttribute="leading" secondItem="Nxb-5v-S7f" secondAttribute="leading" id="U1I-lz-flo"/>
<constraint firstItem="oRz-z8-zG5" firstAttribute="leading" secondItem="ldL-jE-OCW" secondAttribute="leading" constant="7" id="cyQ-pI-l0S"/>
<constraint firstItem="yOy-fE-ehe" firstAttribute="centerX" secondItem="Nxb-5v-S7f" secondAttribute="centerX" id="hmo-Bu-sHj"/>
<constraint firstItem="6bp-EP-4mI" firstAttribute="centerY" secondItem="yOy-fE-ehe" secondAttribute="centerY" id="hsN-tf-ucA"/>
<constraint firstAttribute="trailing" secondItem="Nxb-5v-S7f" secondAttribute="trailing" id="jtd-FL-IPM"/>
<constraint firstItem="Nxb-5v-S7f" firstAttribute="leading" secondItem="W20-Fx-QTq" secondAttribute="leading" id="mH0-V2-F3V"/>
<constraint firstItem="LeW-ad-gVJ" firstAttribute="trailing" secondItem="Nxb-5v-S7f" secondAttribute="trailing" id="mxp-8w-d3f"/>
<constraint firstItem="pwN-H0-3qj" firstAttribute="trailing" secondItem="Nxb-5v-S7f" secondAttribute="trailing" id="uIJ-vM-5eW"/>
<constraint firstItem="LeW-ad-gVJ" firstAttribute="leading" secondItem="Nxb-5v-S7f" secondAttribute="leading" id="yUf-WR-TSj"/>
<constraint firstItem="6bp-EP-4mI" firstAttribute="trailing" secondItem="yOy-fE-ehe" secondAttribute="trailing" constant="-5" id="zC7-5f-4x4"/>
<constraint firstItem="ldL-jE-OCW" firstAttribute="centerX" secondItem="Nxb-5v-S7f" secondAttribute="centerX" id="zTv-YA-C7R"/>
<constraint firstItem="ldL-jE-OCW" firstAttribute="top" secondItem="Nxb-5v-S7f" secondAttribute="top" constant="-30" id="zcc-er-wj1"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="W20-Fx-QTq" firstAttribute="leading" secondItem="9kQ-2p-WMi" secondAttribute="trailing" constant="13" id="7zU-5T-Tpm"/>
<constraint firstItem="W20-Fx-QTq" firstAttribute="top" secondItem="9kQ-2p-WMi" secondAttribute="top" constant="20" id="8su-Hz-Uh8"/>
<constraint firstAttribute="trailing" secondItem="W20-Fx-QTq" secondAttribute="trailing" constant="16" id="9Pb-9f-b52"/>
<constraint firstItem="W20-Fx-QTq" firstAttribute="width" secondItem="fkt-5i-wGo" secondAttribute="width" id="9oW-f3-lh3"/>
<constraint firstItem="9kQ-2p-WMi" firstAttribute="leading" secondItem="fkt-5i-wGo" secondAttribute="trailing" constant="13" id="VDO-dN-V30"/>
<constraint firstItem="fkt-5i-wGo" firstAttribute="leading" secondItem="WH3-Kj-tPl" secondAttribute="leading" constant="16" id="e9c-ou-ab3"/>
<constraint firstItem="fkt-5i-wGo" firstAttribute="top" secondItem="9kQ-2p-WMi" secondAttribute="top" constant="20" id="fLC-0l-VdH"/>
<constraint firstItem="9kQ-2p-WMi" firstAttribute="width" secondItem="fkt-5i-wGo" secondAttribute="width" id="wAU-pa-Nj6"/>
<constraint firstItem="9kQ-2p-WMi" firstAttribute="top" secondItem="WH3-Kj-tPl" secondAttribute="top" constant="10" id="wfM-ih-liC"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="firstHeaderImage" destination="aGF-cs-ovJ" id="rwA-vJ-tQq"/>
<outlet property="firstHeaderImage2" destination="hOp-Tb-y2w" id="Gnw-Vq-Qtz"/>
<outlet property="firstIDLabel" destination="Is5-JJ-W6T" id="yC1-py-IEI"/>
<outlet property="firstNameLabel" destination="Tww-5a-ZSt" id="29c-NC-Cmm"/>
<outlet property="firstRankValueLabel" destination="Z7f-CG-uOk" id="rwb-av-cyP"/>
<outlet property="secondHeaderImage" destination="TYB-N3-5Cs" id="Qge-D4-mRr"/>
<outlet property="secondHeaderImage2" destination="Uue-tQ-gRt" id="BR3-WD-ipi"/>
<outlet property="secondIDLabel" destination="JgV-Ob-RU0" id="pMQ-4f-Eah"/>
<outlet property="secondNameLabel" destination="ckM-s4-iVh" id="Pzl-HS-g11"/>
<outlet property="secondRankValueLabel" destination="hGy-Aa-hUg" id="y6S-Ir-dE9"/>
<outlet property="thirdHeaderImage" destination="oRz-z8-zG5" id="fLv-y2-SGF"/>
<outlet property="thirdHeaderImage2" destination="jh5-rY-O8T" id="aLk-Sw-tny"/>
<outlet property="thirdIDLabel" destination="pwN-H0-3qj" id="Atn-0u-qI3"/>
<outlet property="thirdNameLabel" destination="LeW-ad-gVJ" id="uFh-Id-F4W"/>
<outlet property="thirdRankValueLabel" destination="6bp-EP-4mI" id="JHY-iH-k0p"/>
</connections>
<point key="canvasLocation" x="225.95419847328245" y="117.25352112676057"/>
</view>
</objects>
<resources>
<image name="rank_first_bg" width="110" height="124"/>
<image name="rank_real_love_first_header" width="108" height="65"/>
<image name="rank_real_love_second_header" width="95" height="60"/>
<image name="rank_real_love_third_header" width="95" height="60"/>
<image name="rank_real_love_value_bg" width="85" height="18"/>
<image name="rank_second_bg" width="103" height="116"/>
<image name="rank_third_bg" width="103" height="116"/>
<image name="user_header_placehoulder" width="40" height="40"/>
</resources>
</document>

View File

@@ -0,0 +1,25 @@
//
// QXRankListCell.h
// IsLandVoice
//
// Created by 启星 on 2025/3/4.
//
#import <UIKit/UIKit.h>
#import "QXRankModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRankListCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *numberLabel;
@property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
@property (weak, nonatomic) IBOutlet UILabel *valueLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (nonatomic,strong)QXMyRankModel *model;
/// 1 魅力 2 财富 3 房间 4 cp
@property (nonatomic,assign)NSInteger rankType;
+(instancetype)cellWithTableView:(UITableView*)tableView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,48 @@
//
// QXRankListCell.m
// IsLandVoice
//
// Created by on 2025/3/4.
//
#import "QXRankListCell.h"
@implementation QXRankListCell
+(instancetype)cellWithTableView:(UITableView *)tableView{
static NSString *cellId = @"QXRankListCell";
QXRankListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
}
return cell;
}
-(void)setRankType:(NSInteger)rankType{
_rankType = rankType;
}
-(void)setModel:(QXMyRankModel *)model{
_model = model;
if (self.rankType == 0) {
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.room_cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.nameLabel.text = model.room_name;
self.valueLabel.text = [NSString qx_showHotCountNum:model.total.longLongValue];
self.numberLabel.text = model.rank;
}else{
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.nameLabel.text = model.nickname;
self.valueLabel.text = [NSString qx_showHotCountNum:model.total.longLongValue];
self.numberLabel.text = model.rank;
}
}
- (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

View File

@@ -0,0 +1,92 @@
<?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>
<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="97" id="KGk-i7-Jjw" customClass="QXRankListCell">
<rect key="frame" x="0.0" y="0.0" width="454" height="97"/>
<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="454" height="97"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A6u-gx-qxe">
<rect key="frame" x="15" y="40" width="30" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="nSB-ak-zSd"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="HlF-Pn-DKh">
<rect key="frame" x="55" y="33.666666666666664" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="T1y-jn-Err"/>
<constraint firstAttribute="height" constant="30" id="U9j-xw-QBf"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</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="fzl-QL-ad0">
<rect key="frame" x="101" y="40" width="244" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="33" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M4J-MV-C6I">
<rect key="frame" x="383" y="40" width="55" height="17"/>
<constraints>
<constraint firstAttribute="width" constant="55" id="Y5D-hq-2Hl"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Vector" translatesAutoresizingMaskIntoConstraints="NO" id="6vu-N8-8uU">
<rect key="frame" x="355" y="38.666666666666664" width="20" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="RPP-W2-uG7"/>
<constraint firstAttribute="height" constant="20" id="cIl-7y-QqE"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstItem="M4J-MV-C6I" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="3y8-eP-534"/>
<constraint firstItem="fzl-QL-ad0" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="6qM-F0-kaU"/>
<constraint firstItem="A6u-gx-qxe" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="KTD-SJ-b98"/>
<constraint firstItem="fzl-QL-ad0" firstAttribute="leading" secondItem="HlF-Pn-DKh" secondAttribute="trailing" constant="16" id="KTy-bw-0M9"/>
<constraint firstItem="6vu-N8-8uU" firstAttribute="leading" secondItem="fzl-QL-ad0" secondAttribute="trailing" constant="10" id="KfJ-GU-xhc"/>
<constraint firstItem="HlF-Pn-DKh" firstAttribute="leading" secondItem="A6u-gx-qxe" secondAttribute="trailing" constant="10" id="QEi-Df-wpG"/>
<constraint firstItem="HlF-Pn-DKh" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="UMC-XC-UHT"/>
<constraint firstItem="6vu-N8-8uU" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="Wg4-GR-Vo4"/>
<constraint firstAttribute="trailing" secondItem="M4J-MV-C6I" secondAttribute="trailing" constant="16" id="ZD2-V9-W5N"/>
<constraint firstItem="A6u-gx-qxe" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="hee-RR-oRt"/>
<constraint firstItem="M4J-MV-C6I" firstAttribute="leading" secondItem="6vu-N8-8uU" secondAttribute="trailing" constant="8" symbolic="YES" id="uhf-Kz-A7s"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<connections>
<outlet property="headerImageView" destination="HlF-Pn-DKh" id="qlM-wa-hJv"/>
<outlet property="nameLabel" destination="fzl-QL-ad0" id="LiE-Uw-T5s"/>
<outlet property="numberLabel" destination="A6u-gx-qxe" id="OYi-lV-qcy"/>
<outlet property="valueLabel" destination="M4J-MV-C6I" id="fap-Ij-TGd"/>
</connections>
<point key="canvasLocation" x="241.22137404580153" y="38.380281690140848"/>
</tableViewCell>
</objects>
<resources>
<image name="Vector" width="14" height="14"/>
<image name="user_header_placehoulder" width="128" height="128"/>
</resources>
</document>

View File

@@ -0,0 +1,37 @@
//
// QXRankTopThreeView.h
// IsLandVoice
//
// Created by 启星 on 2025/3/4.
//
#import <UIKit/UIKit.h>
#import "QXRankModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface QXRankTopThreeView : UIView
@property (weak, nonatomic) IBOutlet UIImageView *firstHeaderImage;
@property (weak, nonatomic) IBOutlet UILabel *firstNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *firstIDLabel;
@property (weak, nonatomic) IBOutlet UILabel *firstRankValueLabel;
@property (weak, nonatomic) IBOutlet UIImageView *secondHeaderImage;
@property (weak, nonatomic) IBOutlet UILabel *secondNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *secondIDLabel;
@property (weak, nonatomic) IBOutlet UILabel *secondRankValueLabel;
@property (weak, nonatomic) IBOutlet UIImageView *thirdHeaderImage;
@property (weak, nonatomic) IBOutlet UILabel *thirdNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *thirdIDLabel;
@property (weak, nonatomic) IBOutlet UILabel *thirdRankValueLabel;
@property (nonatomic,strong)NSArray<QXMyRankModel*>*list;
//
@property (nonatomic,strong)NSArray<QXMyRankModel*>*roomList;
@property (nonatomic,strong)NSArray<QXMyRankModel*>*guildList;
-(void)resetView;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,159 @@
//
// QXRankTopThreeView.m
// IsLandVoice
//
// Created by on 2025/3/4.
//
#import "QXRankTopThreeView.h"
@implementation QXRankTopThreeView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self = [[[NSBundle mainBundle]loadNibNamed:@"QXRankTopThreeView" owner:nil options:nil] lastObject];
self.frame = frame;
}
return self;
}
-(void)setList:(NSArray<QXMyRankModel *> *)list{
_list = list;
QXMyRankModel *firstModel;
QXMyRankModel *secondModel;
QXMyRankModel *thirdModel;
if (list.count >= 3) {
firstModel = list[0];
secondModel = list[1];
thirdModel = list[2];
}
if (list.count == 2) {
firstModel = list[0];
secondModel = list[1];
}
if (list.count == 1) {
firstModel = list[0];
}
if (firstModel) {
[self.firstHeaderImage sd_setImageWithURL:[NSURL URLWithString:firstModel.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.firstNameLabel.text = firstModel.nickname;
self.firstIDLabel.text = [NSString stringWithFormat:@"ID:%@",firstModel.user_code];
self.firstRankValueLabel.text = [NSString qx_showHotCountNum:firstModel.total.longLongValue];
self.firstRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
if (secondModel) {
[self.secondHeaderImage sd_setImageWithURL:[NSURL URLWithString:secondModel.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.secondNameLabel.text = secondModel.nickname;
self.secondIDLabel.text = [NSString stringWithFormat:@"ID:%@",secondModel.user_code];
self.secondRankValueLabel.text = [NSString qx_showHotCountNum:secondModel.total.longLongValue];
self.secondRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
if (thirdModel) {
[self.thirdHeaderImage sd_setImageWithURL:[NSURL URLWithString:thirdModel.avatar] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.thirdNameLabel.text = thirdModel.nickname;
self.thirdIDLabel.text = [NSString stringWithFormat:@"ID:%@",thirdModel.user_code];
self.thirdRankValueLabel.text = [NSString qx_showHotCountNum:thirdModel.total.longLongValue];
self.thirdRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
}
-(void)resetView{
self.firstHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.secondHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.thirdHeaderImage.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.firstNameLabel.text = @"虚位以待";
self.secondNameLabel.text = @"虚位以待";
self.thirdNameLabel.text = @"虚位以待";
self.firstIDLabel.text = @"ID:";
self.secondIDLabel.text = @"ID:";
self.thirdIDLabel.text = @"ID:";
}
//
-(void)setRoomList:(NSArray<QXMyRankModel *> *)roomList{
_roomList = roomList;
QXMyRankModel *firstModel;
QXMyRankModel *secondModel;
QXMyRankModel *thirdModel;
if (roomList.count >= 3) {
firstModel = roomList[0];
secondModel = roomList[1];
thirdModel = roomList[2];
}
if (roomList.count == 2) {
firstModel = roomList[0];
secondModel = roomList[1];
}
if (roomList.count == 1) {
firstModel = roomList[0];
}
if (firstModel) {
[self.firstHeaderImage sd_setImageWithURL:[NSURL URLWithString:firstModel.room_cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.firstNameLabel.text = firstModel.room_name;
self.firstIDLabel.text = [NSString stringWithFormat:@"ID:%@",firstModel.room_number];
self.firstRankValueLabel.text = [NSString qx_showHotCountNum:firstModel.total.longLongValue];
self.firstRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
if (secondModel) {
[self.secondHeaderImage sd_setImageWithURL:[NSURL URLWithString:secondModel.room_cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.secondNameLabel.text = secondModel.room_name;
self.secondIDLabel.text = [NSString stringWithFormat:@"ID:%@",secondModel.room_number];
self.secondRankValueLabel.text = [NSString qx_showHotCountNum:secondModel.total.longLongValue];
self.secondRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
if (thirdModel) {
[self.thirdHeaderImage sd_setImageWithURL:[NSURL URLWithString:thirdModel.room_cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.thirdNameLabel.text = thirdModel.room_name;
self.thirdIDLabel.text = [NSString stringWithFormat:@"ID:%@",thirdModel.room_number];
self.thirdRankValueLabel.text = [NSString qx_showHotCountNum:thirdModel.total.longLongValue];
self.thirdRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
}
-(void)setGuildList:(NSArray<QXMyRankModel *> *)guildList{
_guildList = guildList;
QXMyRankModel *firstModel;
QXMyRankModel *secondModel;
QXMyRankModel *thirdModel;
if (guildList.count >= 3) {
firstModel = guildList[0];
secondModel = guildList[1];
thirdModel = guildList[2];
}
if (guildList.count == 2) {
firstModel = guildList[0];
secondModel = guildList[1];
}
if (guildList.count == 1) {
firstModel = guildList[0];
}
if (firstModel) {
[self.firstHeaderImage sd_setImageWithURL:[NSURL URLWithString:firstModel.cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.firstNameLabel.text = firstModel.guild_name;
self.firstIDLabel.text = [NSString stringWithFormat:@"ID:%@",firstModel.guild_special_id];
self.firstRankValueLabel.text = [NSString qx_showHotCountNum:firstModel.total.longLongValue];
self.firstRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
if (secondModel) {
[self.secondHeaderImage sd_setImageWithURL:[NSURL URLWithString:secondModel.cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.secondNameLabel.text = secondModel.guild_name;
self.secondIDLabel.text = [NSString stringWithFormat:@"ID:%@",secondModel.guild_special_id];
self.secondRankValueLabel.text = [NSString qx_showHotCountNum:secondModel.total.longLongValue];
self.secondRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
if (thirdModel) {
[self.thirdHeaderImage sd_setImageWithURL:[NSURL URLWithString:thirdModel.cover] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.thirdNameLabel.text = thirdModel.guild_name;
self.thirdIDLabel.text = [NSString stringWithFormat:@"ID:%@",thirdModel.guild_special_id];
self.thirdRankValueLabel.text = [NSString qx_showHotCountNum:thirdModel.total.longLongValue];
self.thirdRankValueLabel.adjustsFontSizeToFitWidth = YES;
}
}
@end

View File

@@ -0,0 +1,332 @@
<?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" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<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"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="QXRankTopThreeView">
<rect key="frame" x="0.0" y="0.0" width="438" height="230"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XUB-Y8-XcZ">
<rect key="frame" x="16.000000000000007" y="30" width="126.66666666666669" height="190"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_first_bg" translatesAutoresizingMaskIntoConstraints="NO" id="Udd-CZ-76S">
<rect key="frame" x="0.0" y="30" width="126.66666666666667" height="150"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="OpL-6e-PQF"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="yUs-Y6-slK">
<rect key="frame" x="36" y="10" width="55" height="55"/>
<constraints>
<constraint firstAttribute="height" constant="55" id="6eF-8z-4xj"/>
<constraint firstAttribute="width" constant="55" id="V64-MD-1q7"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="27.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_second_header" translatesAutoresizingMaskIntoConstraints="NO" id="AvX-gb-Qj2">
<rect key="frame" x="28.333333333333336" y="2.6666666666666643" width="70" height="70"/>
<constraints>
<constraint firstAttribute="height" constant="70" id="etW-86-HWO"/>
<constraint firstAttribute="width" constant="70" id="yuf-mK-GWS"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TOP 2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hrW-iv-2GA">
<rect key="frame" x="0.0" y="77.666666666666671" width="126.66666666666667" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="ePo-8S-kGh"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="17"/>
<color key="textColor" red="0.27058823529411763" green="0.52549019607843139" blue="0.8666666666666667" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1cb-gO-110">
<rect key="frame" x="0.0" y="104.66666666666666" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YVj-S5-pMv">
<rect key="frame" x="0.0" y="124.66666666666666" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_value_bg" translatesAutoresizingMaskIntoConstraints="NO" id="cNU-er-wVt">
<rect key="frame" x="21" y="150" width="85" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="85" id="a6v-Ha-yCN"/>
<constraint firstAttribute="height" constant="20" id="qrO-iJ-Ran"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N38-n0-ZM2">
<rect key="frame" x="41" y="149.66666666666666" width="60" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="DWS-UI-7S3"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="cNU-er-wVt" firstAttribute="centerX" secondItem="Udd-CZ-76S" secondAttribute="centerX" id="0ZC-eg-UcP"/>
<constraint firstItem="yUs-Y6-slK" firstAttribute="centerX" secondItem="Udd-CZ-76S" secondAttribute="centerX" id="3zb-ps-32a"/>
<constraint firstAttribute="trailing" secondItem="Udd-CZ-76S" secondAttribute="trailing" id="5Xc-AW-dq0"/>
<constraint firstItem="cNU-er-wVt" firstAttribute="bottom" secondItem="Udd-CZ-76S" secondAttribute="bottom" constant="-10" id="8Jy-xb-M2A"/>
<constraint firstItem="1cb-gO-110" firstAttribute="leading" secondItem="Udd-CZ-76S" secondAttribute="leading" id="GzX-Vy-k5H"/>
<constraint firstItem="hrW-iv-2GA" firstAttribute="top" secondItem="AvX-gb-Qj2" secondAttribute="bottom" constant="5" id="JdB-Mt-Ubh"/>
<constraint firstAttribute="height" constant="190" id="Jfy-QF-AUp"/>
<constraint firstItem="1cb-gO-110" firstAttribute="top" secondItem="hrW-iv-2GA" secondAttribute="bottom" constant="2" id="Mid-SH-KMl"/>
<constraint firstItem="YVj-S5-pMv" firstAttribute="trailing" secondItem="Udd-CZ-76S" secondAttribute="trailing" id="QYa-aT-fWw"/>
<constraint firstAttribute="bottom" secondItem="Udd-CZ-76S" secondAttribute="bottom" constant="10" id="asr-zA-QjP"/>
<constraint firstItem="hrW-iv-2GA" firstAttribute="trailing" secondItem="Udd-CZ-76S" secondAttribute="trailing" id="f00-XJ-SYT"/>
<constraint firstItem="hrW-iv-2GA" firstAttribute="leading" secondItem="Udd-CZ-76S" secondAttribute="leading" id="gMf-cA-GyC"/>
<constraint firstItem="YVj-S5-pMv" firstAttribute="leading" secondItem="Udd-CZ-76S" secondAttribute="leading" id="iuR-XR-by4"/>
<constraint firstItem="AvX-gb-Qj2" firstAttribute="centerY" secondItem="yUs-Y6-slK" secondAttribute="centerY" id="o0C-7g-FaY"/>
<constraint firstItem="N38-n0-ZM2" firstAttribute="centerY" secondItem="cNU-er-wVt" secondAttribute="centerY" id="qgC-JE-VoE"/>
<constraint firstItem="YVj-S5-pMv" firstAttribute="top" secondItem="1cb-gO-110" secondAttribute="bottom" constant="3" id="rue-Mh-n41"/>
<constraint firstItem="Udd-CZ-76S" firstAttribute="leading" secondItem="XUB-Y8-XcZ" secondAttribute="leading" id="t53-rK-r8p"/>
<constraint firstItem="N38-n0-ZM2" firstAttribute="leading" secondItem="cNU-er-wVt" secondAttribute="leading" constant="20" id="tvs-gN-vfv"/>
<constraint firstItem="yUs-Y6-slK" firstAttribute="top" secondItem="Udd-CZ-76S" secondAttribute="top" constant="-20" id="wlR-gY-AfB"/>
<constraint firstItem="1cb-gO-110" firstAttribute="trailing" secondItem="Udd-CZ-76S" secondAttribute="trailing" id="wqs-cd-axN"/>
<constraint firstItem="N38-n0-ZM2" firstAttribute="trailing" secondItem="cNU-er-wVt" secondAttribute="trailing" constant="-5" id="wtQ-ub-w9L"/>
<constraint firstItem="AvX-gb-Qj2" firstAttribute="centerX" secondItem="yUs-Y6-slK" secondAttribute="centerX" id="yWU-0M-37q"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YTz-cQ-cnc">
<rect key="frame" x="155.66666666666666" y="10" width="126.66666666666666" height="190"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_second_bg" translatesAutoresizingMaskIntoConstraints="NO" id="OYC-81-j70">
<rect key="frame" x="0.0" y="30" width="126.66666666666667" height="150"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="20d-Os-Gh8"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="Qla-Q4-61p">
<rect key="frame" x="36" y="10" width="55" height="55"/>
<constraints>
<constraint firstAttribute="height" constant="55" id="dF6-xJ-QPU"/>
<constraint firstAttribute="width" constant="55" id="y73-KC-MmY"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="27.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_first_header" translatesAutoresizingMaskIntoConstraints="NO" id="b5j-h9-fHj">
<rect key="frame" x="28.333333333333343" y="2.6666666666666643" width="70" height="70"/>
<constraints>
<constraint firstAttribute="height" constant="70" id="RPj-PA-Yue"/>
<constraint firstAttribute="width" constant="70" id="UEq-Yf-IPd"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TOP 1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yag-FZ-Hxd">
<rect key="frame" x="0.0" y="77.666666666666671" width="126.66666666666667" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="4w5-Rv-dCA"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="17"/>
<color key="textColor" red="0.84313725490196079" green="0.30196078431372547" blue="0.17254901960784313" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZoJ-2X-OhT">
<rect key="frame" x="0.0" y="104.66666666666667" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="y6v-rD-4Gf">
<rect key="frame" x="0.0" y="124.66666666666666" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_value_bg" translatesAutoresizingMaskIntoConstraints="NO" id="AP3-Al-g1n">
<rect key="frame" x="21" y="150" width="85" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="85" id="94n-mT-9iE"/>
<constraint firstAttribute="height" constant="20" id="QgK-xn-ORo"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UPu-Oc-Pap">
<rect key="frame" x="41" y="149.66666666666666" width="60" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="oZt-bc-coz"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="y6v-rD-4Gf" firstAttribute="trailing" secondItem="OYC-81-j70" secondAttribute="trailing" id="38A-WK-w2o"/>
<constraint firstItem="Yag-FZ-Hxd" firstAttribute="trailing" secondItem="OYC-81-j70" secondAttribute="trailing" id="3vs-tP-yFe"/>
<constraint firstItem="y6v-rD-4Gf" firstAttribute="leading" secondItem="OYC-81-j70" secondAttribute="leading" id="5i5-yN-jA7"/>
<constraint firstItem="y6v-rD-4Gf" firstAttribute="top" secondItem="ZoJ-2X-OhT" secondAttribute="bottom" constant="3" id="8Qo-tE-ZQB"/>
<constraint firstItem="UPu-Oc-Pap" firstAttribute="centerY" secondItem="AP3-Al-g1n" secondAttribute="centerY" id="DwW-Xy-41n"/>
<constraint firstItem="UPu-Oc-Pap" firstAttribute="leading" secondItem="AP3-Al-g1n" secondAttribute="leading" constant="20" id="EEW-9Y-c6k"/>
<constraint firstItem="ZoJ-2X-OhT" firstAttribute="leading" secondItem="OYC-81-j70" secondAttribute="leading" id="FoV-c3-OQp"/>
<constraint firstItem="Qla-Q4-61p" firstAttribute="centerX" secondItem="OYC-81-j70" secondAttribute="centerX" id="GlL-b6-uM4"/>
<constraint firstItem="AP3-Al-g1n" firstAttribute="centerX" secondItem="OYC-81-j70" secondAttribute="centerX" id="Yrt-Wy-qFX"/>
<constraint firstItem="Yag-FZ-Hxd" firstAttribute="leading" secondItem="OYC-81-j70" secondAttribute="leading" id="asH-Gs-kM0"/>
<constraint firstItem="Yag-FZ-Hxd" firstAttribute="top" secondItem="b5j-h9-fHj" secondAttribute="bottom" constant="5" id="cNy-cu-FRK"/>
<constraint firstItem="Qla-Q4-61p" firstAttribute="top" secondItem="OYC-81-j70" secondAttribute="top" constant="-20" id="d8L-tR-zrX"/>
<constraint firstItem="UPu-Oc-Pap" firstAttribute="trailing" secondItem="AP3-Al-g1n" secondAttribute="trailing" constant="-5" id="gLB-Qa-3yB"/>
<constraint firstItem="ZoJ-2X-OhT" firstAttribute="top" secondItem="Yag-FZ-Hxd" secondAttribute="bottom" constant="2" id="hkT-40-gxD"/>
<constraint firstItem="b5j-h9-fHj" firstAttribute="centerX" secondItem="Qla-Q4-61p" secondAttribute="centerX" id="qeS-Ko-x2k"/>
<constraint firstAttribute="bottom" secondItem="OYC-81-j70" secondAttribute="bottom" constant="10" id="qra-jQ-HuG"/>
<constraint firstItem="OYC-81-j70" firstAttribute="leading" secondItem="YTz-cQ-cnc" secondAttribute="leading" id="ui1-rt-TLL"/>
<constraint firstItem="b5j-h9-fHj" firstAttribute="centerY" secondItem="Qla-Q4-61p" secondAttribute="centerY" id="wE7-kT-0cA"/>
<constraint firstItem="ZoJ-2X-OhT" firstAttribute="trailing" secondItem="OYC-81-j70" secondAttribute="trailing" id="xUJ-An-uJd"/>
<constraint firstItem="AP3-Al-g1n" firstAttribute="bottom" secondItem="OYC-81-j70" secondAttribute="bottom" constant="-10" id="yJS-5l-52b"/>
<constraint firstAttribute="height" constant="190" id="ymO-VJ-qeF"/>
<constraint firstAttribute="trailing" secondItem="OYC-81-j70" secondAttribute="trailing" id="zi1-Z3-Vdu"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="v5g-yt-Tiv">
<rect key="frame" x="295.33333333333331" y="30" width="126.66666666666669" height="190"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_third_bg" translatesAutoresizingMaskIntoConstraints="NO" id="bAp-HV-Zc7">
<rect key="frame" x="0.0" y="30" width="126.66666666666667" height="150"/>
<constraints>
<constraint firstAttribute="height" constant="150" id="i6w-Yw-0XV"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_header_placehoulder" translatesAutoresizingMaskIntoConstraints="NO" id="Dt4-sc-cd4">
<rect key="frame" x="36" y="10" width="55" height="55"/>
<constraints>
<constraint firstAttribute="height" constant="55" id="Jnt-9u-oIl"/>
<constraint firstAttribute="width" constant="55" id="ZOy-UO-FXw"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<real key="value" value="27.5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_third_header" translatesAutoresizingMaskIntoConstraints="NO" id="O3B-Qw-b3G">
<rect key="frame" x="28.333333333333371" y="2.6666666666666643" width="70" height="70"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="BXi-JR-Idl"/>
<constraint firstAttribute="height" constant="70" id="mHP-Gy-cuf"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TOP 3" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FvS-gS-VUF">
<rect key="frame" x="0.0" y="74.666666666666671" width="126.66666666666667" height="25"/>
<constraints>
<constraint firstAttribute="height" constant="25" id="yHg-qN-S7S"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="17"/>
<color key="textColor" red="0.8901960784313725" green="0.5647524634853941" blue="0.27059417517006801" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="虚位以待" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zaf-sd-VhI">
<rect key="frame" x="0.0" y="101.66666666666666" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ID:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XSS-VJ-7Gi">
<rect key="frame" x="0.0" y="121.66666666666666" width="126.66666666666667" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="rank_value_bg" translatesAutoresizingMaskIntoConstraints="NO" id="xIs-Qs-ZUi">
<rect key="frame" x="21" y="150" width="85" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="5CX-XP-Nzj"/>
<constraint firstAttribute="width" constant="85" id="Cwb-nd-chf"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7n9-wN-Uuy">
<rect key="frame" x="41" y="149.66666666666666" width="60" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="8hr-2B-Svz"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="FvS-gS-VUF" firstAttribute="leading" secondItem="bAp-HV-Zc7" secondAttribute="leading" id="0JF-KO-SFJ"/>
<constraint firstItem="bAp-HV-Zc7" firstAttribute="leading" secondItem="v5g-yt-Tiv" secondAttribute="leading" id="2h5-iQ-9oL"/>
<constraint firstItem="7n9-wN-Uuy" firstAttribute="centerY" secondItem="xIs-Qs-ZUi" secondAttribute="centerY" id="2lI-Rd-UDg"/>
<constraint firstItem="XSS-VJ-7Gi" firstAttribute="top" secondItem="zaf-sd-VhI" secondAttribute="bottom" constant="3" id="2lN-Re-eP4"/>
<constraint firstItem="O3B-Qw-b3G" firstAttribute="centerY" secondItem="Dt4-sc-cd4" secondAttribute="centerY" id="4wN-aC-Dp3"/>
<constraint firstAttribute="height" constant="190" id="59l-Xe-SZI"/>
<constraint firstItem="zaf-sd-VhI" firstAttribute="trailing" secondItem="bAp-HV-Zc7" secondAttribute="trailing" id="83l-Mo-KDX"/>
<constraint firstAttribute="bottom" secondItem="bAp-HV-Zc7" secondAttribute="bottom" constant="10" id="Bjo-RJ-N9Q"/>
<constraint firstItem="7n9-wN-Uuy" firstAttribute="trailing" secondItem="xIs-Qs-ZUi" secondAttribute="trailing" constant="-5" id="MIJ-zp-9TR"/>
<constraint firstItem="FvS-gS-VUF" firstAttribute="trailing" secondItem="bAp-HV-Zc7" secondAttribute="trailing" id="O6G-zi-LeN"/>
<constraint firstItem="Dt4-sc-cd4" firstAttribute="top" secondItem="bAp-HV-Zc7" secondAttribute="top" constant="-20" id="W6G-2n-pkC"/>
<constraint firstItem="Dt4-sc-cd4" firstAttribute="centerX" secondItem="bAp-HV-Zc7" secondAttribute="centerX" id="ZeF-xV-20d"/>
<constraint firstItem="XSS-VJ-7Gi" firstAttribute="trailing" secondItem="bAp-HV-Zc7" secondAttribute="trailing" id="e2C-Tu-0qj"/>
<constraint firstItem="zaf-sd-VhI" firstAttribute="top" secondItem="FvS-gS-VUF" secondAttribute="bottom" constant="2" id="g57-ez-75o"/>
<constraint firstItem="XSS-VJ-7Gi" firstAttribute="leading" secondItem="bAp-HV-Zc7" secondAttribute="leading" id="j2M-tH-Nkl"/>
<constraint firstItem="O3B-Qw-b3G" firstAttribute="centerX" secondItem="Dt4-sc-cd4" secondAttribute="centerX" id="jtI-yw-AVJ"/>
<constraint firstItem="xIs-Qs-ZUi" firstAttribute="bottom" secondItem="bAp-HV-Zc7" secondAttribute="bottom" constant="-10" id="n6f-YO-GEj"/>
<constraint firstItem="FvS-gS-VUF" firstAttribute="top" secondItem="O3B-Qw-b3G" secondAttribute="bottom" constant="2" id="pCS-8t-Sdh"/>
<constraint firstItem="zaf-sd-VhI" firstAttribute="leading" secondItem="bAp-HV-Zc7" secondAttribute="leading" id="u55-Sp-Gcu"/>
<constraint firstItem="7n9-wN-Uuy" firstAttribute="leading" secondItem="xIs-Qs-ZUi" secondAttribute="leading" constant="20" id="ucl-We-U9T"/>
<constraint firstAttribute="trailing" secondItem="bAp-HV-Zc7" secondAttribute="trailing" id="w0H-sm-R6j"/>
<constraint firstItem="xIs-Qs-ZUi" firstAttribute="centerX" secondItem="bAp-HV-Zc7" secondAttribute="centerX" id="x7Y-HY-I4W"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="v5g-yt-Tiv" firstAttribute="top" secondItem="YTz-cQ-cnc" secondAttribute="top" constant="20" id="0R3-r5-Wxd"/>
<constraint firstItem="XUB-Y8-XcZ" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="16" id="N3B-R1-7yD"/>
<constraint firstItem="XUB-Y8-XcZ" firstAttribute="top" secondItem="YTz-cQ-cnc" secondAttribute="top" constant="20" id="T7Y-QD-Rmk"/>
<constraint firstAttribute="trailing" secondItem="v5g-yt-Tiv" secondAttribute="trailing" constant="16" id="WVw-as-Mru"/>
<constraint firstItem="YTz-cQ-cnc" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="Xam-R0-afY"/>
<constraint firstItem="YTz-cQ-cnc" firstAttribute="width" secondItem="XUB-Y8-XcZ" secondAttribute="width" id="bjS-d4-o6d"/>
<constraint firstItem="YTz-cQ-cnc" firstAttribute="leading" secondItem="XUB-Y8-XcZ" secondAttribute="trailing" constant="13" id="grr-dS-qvb"/>
<constraint firstItem="v5g-yt-Tiv" firstAttribute="width" secondItem="XUB-Y8-XcZ" secondAttribute="width" id="kyg-aW-8jU"/>
<constraint firstItem="v5g-yt-Tiv" firstAttribute="leading" secondItem="YTz-cQ-cnc" secondAttribute="trailing" constant="13" id="mho-CF-53Q"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="firstHeaderImage" destination="Qla-Q4-61p" id="9iw-tV-D9i"/>
<outlet property="firstIDLabel" destination="y6v-rD-4Gf" id="Zu5-7N-rE4"/>
<outlet property="firstNameLabel" destination="ZoJ-2X-OhT" id="RE2-pw-FkQ"/>
<outlet property="firstRankValueLabel" destination="UPu-Oc-Pap" id="bI7-rg-MwP"/>
<outlet property="secondHeaderImage" destination="yUs-Y6-slK" id="uyW-dP-THq"/>
<outlet property="secondIDLabel" destination="YVj-S5-pMv" id="hhc-qc-U1J"/>
<outlet property="secondNameLabel" destination="1cb-gO-110" id="kZA-l2-ULy"/>
<outlet property="secondRankValueLabel" destination="N38-n0-ZM2" id="58k-o4-2cZ"/>
<outlet property="thirdHeaderImage" destination="Dt4-sc-cd4" id="Xnp-w3-omi"/>
<outlet property="thirdIDLabel" destination="XSS-VJ-7Gi" id="Ion-fD-0im"/>
<outlet property="thirdNameLabel" destination="zaf-sd-VhI" id="i1e-MY-xKc"/>
<outlet property="thirdRankValueLabel" destination="7n9-wN-Uuy" id="JTa-ty-Wtk"/>
</connections>
<point key="canvasLocation" x="225.95419847328245" y="117.25352112676057"/>
</view>
</objects>
<resources>
<image name="rank_first_bg" width="110" height="124"/>
<image name="rank_first_header" width="64" height="64"/>
<image name="rank_second_bg" width="103" height="116"/>
<image name="rank_second_header" width="64" height="64"/>
<image name="rank_third_bg" width="103" height="116"/>
<image name="rank_third_header" width="64" height="64"/>
<image name="rank_value_bg" width="85" height="18"/>
<image name="user_header_placehoulder" width="40" height="40"/>
</resources>
</document>

View File

@@ -0,0 +1,23 @@
//
// QXRankTypeView.h
// IsLandVoice
//
// Created by 启星 on 2025/3/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger) {
QXRankTypeDay = 1,
QXRankTypeWeek = 2,
QXRankTypeMonth
}QXRankType;
@interface QXRankTypeView : UIView
@property (nonatomic,copy)void(^rankTypeBlock)(QXRankType type);
@end
@interface QXRankTypeButton : UIButton
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,118 @@
//
// QXRankTypeView.m
// IsLandVoice
//
// Created by on 2025/3/3.
//
#import "QXRankTypeView.h"
@interface QXRankTypeView()
@property (nonatomic,strong)QXRankTypeButton*dayBtn;
@property (nonatomic,strong)QXRankTypeButton*weekBtn;
@property (nonatomic,strong)QXRankTypeButton*monthBtn;
@property (nonatomic,strong)QXRankTypeButton*tmpBtn;
@end
@implementation QXRankTypeView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self createViews];
}
return self;
}
-(void)createViews{
self.dayBtn.selected = YES;
[self addSubview:self.dayBtn];
[self addSubview:self.weekBtn];
[self addSubview:self.monthBtn];
self.tmpBtn = self.dayBtn;
CGFloat btnWidth = (SCREEN_WIDTH-64*2-16*2)/3.0;
[self.dayBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(64);
make.height.mas_equalTo(35);
make.width.mas_equalTo(btnWidth);
make.centerY.mas_equalTo(self);
}];
[self.weekBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.dayBtn.mas_right).offset(16);
make.height.mas_equalTo(35);
make.width.mas_equalTo(btnWidth);
make.centerY.mas_equalTo(self);
}];
[self.monthBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.weekBtn.mas_right).offset(16);
make.height.mas_equalTo(35);
make.width.mas_equalTo(btnWidth);
make.centerY.mas_equalTo(self);
}];
}
-(void)typeAction:(QXRankTypeButton*)button{
self.tmpBtn.selected = !self.tmpBtn.selected;
button.selected = !button.selected;
self.tmpBtn = button;
if (self.rankTypeBlock) {
self.rankTypeBlock(button.tag);
}
}
-(QXRankTypeButton *)dayBtn{
if (!_dayBtn) {
_dayBtn = [[QXRankTypeButton alloc] init];
[_dayBtn setTitle:@"日榜" forState:(UIControlStateNormal)];
[_dayBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
_dayBtn.layer.masksToBounds = YES;
_dayBtn.layer.cornerRadius = 17.5;
_dayBtn.tag = 1;
}
return _dayBtn;
}
-(QXRankTypeButton *)weekBtn{
if (!_weekBtn) {
_weekBtn = [[QXRankTypeButton alloc] init];
[_weekBtn setTitle:@"周榜" forState:(UIControlStateNormal)];
[_weekBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
_weekBtn.layer.masksToBounds = YES;
_weekBtn.layer.cornerRadius = 17.5;
_weekBtn.tag = 2;
}
return _weekBtn;
}
-(QXRankTypeButton *)monthBtn{
if (!_monthBtn) {
_monthBtn = [[QXRankTypeButton alloc] init];
[_monthBtn setTitle:@"月榜" forState:(UIControlStateNormal)];
[_monthBtn addTarget:self action:@selector(typeAction:) forControlEvents:(UIControlEventTouchUpInside)];
_monthBtn.layer.masksToBounds = YES;
_monthBtn.layer.cornerRadius = 17.5;
_monthBtn.tag = 3;
}
return _monthBtn;
}
@end
@implementation QXRankTypeButton
- (instancetype)init
{
self = [super init];
if (self) {
[self setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
self.titleLabel.font = [UIFont boldSystemFontOfSize:14];
self.backgroundColor = RGB16(0xF6F6F6);
}
return self;
}
-(void)setSelected:(BOOL)selected{
[super setSelected:selected];
if (selected) {
self.backgroundColor = QXConfig.themeColor ;
}else{
self.backgroundColor = RGB16(0xF6F6F6);
}
}
@end

View File

@@ -0,0 +1,26 @@
//
// QXSearchCell.h
// QXLive
//
// Created by 启星 on 2025/5/8.
//
#import <UIKit/UIKit.h>
#import "QXUserModel.h"
typedef NS_ENUM(NSInteger) {
QXSearchCellTypeSearch = 0,
QXSearchCellTypeChangeIntroduce,
QXSearchCellTypeIntroduce
}QXSearchCellType ;
NS_ASSUME_NONNULL_BEGIN
@interface QXSearchCell : UICollectionViewCell
@property(nonatomic,strong)UIImageView* backImageView;
@property(nonatomic,strong)UILabel* titleLabel;
@property(nonatomic,assign)QXSearchCellType cellType;
+ (NSString *)cellIdentifier;
@property(nonatomic,strong)QXUserTag *userTag;
+ (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,113 @@
//
// QXSearchCell.m
// QXLive
//
// Created by on 2025/5/8.
//
#import "QXSearchCell.h"
@implementation QXSearchCell
+ (NSString *)cellIdentifier {
return @"QXSearchCell";
}
+ (instancetype)cellWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
QXSearchCell *cell = (QXSearchCell*)[collectionView dequeueReusableCellWithReuseIdentifier:[QXSearchCell cellIdentifier] forIndexPath:indexPath];
return cell;
}
- (instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
self.contentView.backgroundColor = RGB16(0xF3F3F3);
self.contentView.layer.cornerRadius = 11;
self.contentView.layer.masksToBounds = YES;
self.contentView.layer.borderColor = [UIColor blackColor].CGColor;
self.contentView.layer.borderWidth = 0.4;
[self.contentView addSubview:self.backImageView];
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.contentView);
}];
[self.contentView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.contentView);
}];
}
return self;
}
-(void)setCellType:(QXSearchCellType)cellType{
_cellType = cellType;
switch (cellType) {
case QXSearchCellTypeSearch:{
self.contentView.backgroundColor = RGB16(0xF3F3F3);
self.contentView.layer.cornerRadius = 11;
self.contentView.layer.masksToBounds = YES;
self.contentView.layer.borderColor = [UIColor blackColor].CGColor;
self.contentView.layer.borderWidth = 0.4;
_titleLabel.textColor = RGB16(0x666666);
}
break;
case QXSearchCellTypeChangeIntroduce:{
self.contentView.backgroundColor = RGB16(0xF3F3F3);
self.contentView.layer.cornerRadius = 11;
self.contentView.layer.masksToBounds = YES;
self.contentView.layer.borderColor = [UIColor blackColor].CGColor;
self.contentView.layer.borderWidth = 0;
_titleLabel.textColor = RGB16(0x999999);
}
break;
case QXSearchCellTypeIntroduce:{
self.contentView.backgroundColor = RGB16(0xBBFFEB);
self.contentView.layer.cornerRadius = 11;
self.contentView.layer.masksToBounds = YES;
self.contentView.layer.borderColor = [UIColor blackColor].CGColor;
self.contentView.layer.borderWidth = 0;
_titleLabel.textColor = RGB16(0x006B4C);
}
break;
default:
break;
}
}
-(void)setUserTag:(QXUserTag *)userTag{
_userTag = userTag;
self.titleLabel.text = userTag.tag_name;
if (self.cellType == QXSearchCellTypeIntroduce) {
return;
}
if (userTag.isSelected) {
self.contentView.backgroundColor = RGB16(0xBBFFEB);
self.contentView.layer.cornerRadius = 11;
self.contentView.layer.masksToBounds = YES;
self.contentView.layer.borderColor = [UIColor blackColor].CGColor;
self.contentView.layer.borderWidth = 0;
_titleLabel.textColor = RGB16(0x006B4C);
}else{
self.contentView.backgroundColor = RGB16(0xF3F3F3);
self.contentView.layer.cornerRadius = 11;
self.contentView.layer.masksToBounds = YES;
self.contentView.layer.borderColor = [UIColor blackColor].CGColor;
self.contentView.layer.borderWidth = 0;
_titleLabel.textColor = RGB16(0x999999);
}
}
- (UIImageView*)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc]init];
_backImageView.contentMode = UIViewContentModeScaleAspectFill;
}
return _backImageView;
}
- (UILabel*)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc]init];
_titleLabel.font = [UIFont boldSystemFontOfSize:12];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = RGB16(0x666666);
}
return _titleLabel;
}
@end

View File

@@ -0,0 +1,18 @@
//
// QXSearchHeaderView.h
// QXLive
//
// Created by 启星 on 2025/5/8.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXSearchHeaderView : UICollectionReusableView
+ (NSString *)headerViewIdentifier ;
+ (instancetype)headerViewWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath;
@property (nonatomic,strong)NSString *title;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,48 @@
//
// QXSearchHeaderView.m
// QXLive
//
// Created by on 2025/5/8.
//
#import "QXSearchHeaderView.h"
@interface QXSearchHeaderView()
@property (nonatomic,strong)UILabel *headerLabel;
@end
@implementation QXSearchHeaderView
+ (NSString *)headerViewIdentifier {
return @"QXSearchHeaderView";
}
+ (instancetype)headerViewWithCollectionView:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
QXSearchHeaderView *headerView = (QXSearchHeaderView*)[collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:[QXSearchHeaderView headerViewIdentifier] forIndexPath:indexPath];
headerView.backgroundColor = [UIColor clearColor];
return headerView;
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self addSubview:self.headerLabel];
[self.headerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.left.mas_equalTo(16);
}];
}
return self;
}
-(void)setTitle:(NSString *)title{
_title = title;
self.headerLabel.text = title;
}
- (UILabel*)headerLabel {
if (!_headerLabel) {
_headerLabel = [[UILabel alloc]init];
_headerLabel.font = [UIFont boldSystemFontOfSize:16];
_headerLabel.textColor = QXConfig.textColor;
}
return _headerLabel;
}
@end

View File

@@ -0,0 +1,25 @@
//
// QXSearchTopView.h
// QXLive
//
// Created by 启星 on 2025/5/8.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@protocol QXSearchTopViewDelegate <NSObject>
@optional
/// 点击取消
-(void)didClickCancel;
/// 点击搜素
-(void)didClickSearchWithKeywords:(NSString*)keywords;
@end
@interface QXSearchTopView : UIView
@property (nonatomic,weak)id<QXSearchTopViewDelegate>delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,105 @@
//
// QXSearchTopView.m
// QXLive
//
// Created by on 2025/5/8.
//
#import "QXSearchTopView.h"
@interface QXSearchTopView()<UITextFieldDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *searchIcon;
@property (nonatomic,strong)UITextField *textField;
@property (nonatomic,strong)UIButton *cancelBtn;
@end
@implementation QXSearchTopView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubviews];
}
return self;
}
-(void)initSubviews{
UIButton*backBtn = [[UIButton alloc] init];
[backBtn setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)];
backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:backBtn];
[backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(12);
make.size.mas_equalTo(CGSizeMake(44, 44));
make.centerY.equalTo(self);
}];
self.bgView = [[UIView alloc] init];
[self.bgView addRoundedCornersWithRadius:16];
self.bgView.layer.borderWidth = 1.5;
self.bgView.layer.borderColor = RGB16(0x333333).CGColor;
[self addSubview:self.bgView];
self.searchIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_search"]];
[self.bgView addSubview:self.searchIcon];
self.textField = [[UITextField alloc] init];
self.textField.delegate = self;
self.textField.returnKeyType = UIReturnKeySearch;
self.textField.font = [UIFont systemFontOfSize:12];
self.textField.textColor = QXConfig.textColor;
self.textField.placeholder = QXText(@"搜索内容(标签/房间号/名称)");
[self.bgView addSubview:self.textField];
self.cancelBtn = [[UIButton alloc] init];
[self.cancelBtn setTitle:QXText(@"取消") forState:(UIControlStateNormal)];
self.cancelBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.cancelBtn setTitleColor:QXConfig.textColor forState:(UIControlStateNormal)];
self.cancelBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentTrailing;
[self.cancelBtn addTarget:self action:@selector(cancelAction:) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.cancelBtn];
[self.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.top.bottom.equalTo(self);
make.width.mas_equalTo(48);
}];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(backBtn.mas_right).offset(3);
make.centerY.equalTo(self);
make.height.mas_equalTo(32);
make.right.equalTo(self.cancelBtn.mas_left);
}];
[self.searchIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(8);
make.size.mas_equalTo(CGSizeMake(24, 24));
make.centerY.equalTo(self.bgView);
}];
[self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.searchIcon.mas_right).offset(4);
make.top.bottom.equalTo(self.bgView);
make.right.equalTo(self.bgView).offset(-8);
}];
}
-(void)cancelAction:(UIButton*)sender{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickCancel)]) {
[self.delegate didClickCancel];
}
}
-(void)backAction{
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickCancel)]) {
[self.delegate didClickCancel];
}
}
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickSearchWithKeywords:)]) {
[self.delegate didClickSearchWithKeywords:textField.text];
}
return YES;
}
@end