Commit 02330ed2 authored by Mazy's avatar Mazy

feat: add ranking list

parent e8334ec9
This diff is collapsed.
......@@ -24,6 +24,7 @@
#import "GYLoginViewController.h"
#import "GYCashSixAwardAlertView.h"
#import "WelfareCenterVC.h"
#import "GYRankingViewController.h"
UnityFramework* UnityFrameworkLoad()
{
......@@ -117,8 +118,16 @@ NSDictionary* appLaunchOpts;
// 跳转上榜
- (void)ios_ranklistClick {
[[CGUserManager shared] addLocCollection:@"show_Leaderboard" value:@""];
[self unityVideo:false];
GYRankingViewController *rankingVC = [[GYRankingViewController alloc] init];
UINavigationController * navc = [[UINavigationController alloc] initWithRootViewController:rankingVC];
navc.modalPresentationStyle = UIModalPresentationFullScreen;
[[[self ufw] appController].window.rootViewController presentViewController:navc animated:YES completion:nil];
return;
GYWebViewController * web = [[GYWebViewController alloc] init];
web.url = [[CGUserManager shared].h5_url objectForKey:@"rankingurl"];
if (web.url == nil || web.url.length == 0) {
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ranking_1_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ranking_1_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ranking_2_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ranking_2_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ranking_3_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ranking_3_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ranking_back_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ranking_back_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
//
// UIColor+HExtension.h
// ExerciseAnimation
//
// Created by L.mac on 2019/5/10.
// Copyright © 2019 L.mac. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIColor (HExtension)
/**
使用 16 进制数字创建颜色,例如 0xFF0000 创建红色
@param hex 16 进制无符号32位整数
@return 颜色
*/
+ (instancetype)colorWithHex:(uint32_t)hex;
/**
产生随机色
@return 随机色
*/
+ (instancetype)randomColor;
/**
支持三种格式颜色字符串@"123456" @"0x123456" @"#123456"输入
@param color 十六进制颜色字符串
@param alpha 透明度
@return Color
*/
+ (UIColor *)colorWithHexString:(NSString *)color alpha:(CGFloat)alpha;
/**
支持三种格式颜色字符串@"123456" @"0x123456" @"#123456"输入
@param color 十六进制颜色字符串
@return Color
*/
+ (UIColor *)colorWithHexString:(NSString *)color;
@end
NS_ASSUME_NONNULL_END
//
// UIColor+HExtension.m
// ExerciseAnimation
//
// Created by L.mac on 2019/5/10.
// Copyright © 2019 L.mac. All rights reserved.
//
#import "UIColor+HExtension.h"
@implementation UIColor (HExtension)
+ (instancetype)colorWithHex:(uint32_t)hex {
int red, green, blue;
blue = hex & 0x000000FF;
green = ((hex & 0x0000FF00) >> 8);
red = ((hex & 0x00FF0000) >> 16);
return [UIColor colorWithRed:red/255.0f
green:green/255.0f
blue:blue/255.0f
alpha:1.0f];
}
+ (instancetype)randomColor {
return [UIColor colorWithRed:((float)arc4random_uniform(256) / 255.0) green:((float)arc4random_uniform(256) / 255.0) blue:((float)arc4random_uniform(256) / 255.0) alpha:1.0];
}
+ (UIColor *)colorWithHexString:(NSString *)color alpha:(CGFloat)alpha{
NSString *cString = [[color stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
// String should be 6 or 8 characters
if ([cString length] < 6)
{
return [UIColor clearColor];
}
// strip 0X if it appears
//如果是0x开头的,那么截取字符串,字符串从索引为2的位置开始,一直到末尾
if ([cString hasPrefix:@"0X"])
{
cString = [cString substringFromIndex:2];
}
//如果是#开头的,那么截取字符串,字符串从索引为1的位置开始,一直到末尾
if ([cString hasPrefix:@"#"])
{
cString = [cString substringFromIndex:1];
}
if ([cString length] != 6)
{
return [UIColor clearColor];
}
// Separate into r, g, b substrings
NSRange range;
range.location = 0;
range.length = 2;
//r
NSString *rString = [cString substringWithRange:range];
//g
range.location = 2;
NSString *gString = [cString substringWithRange:range];
//b
range.location = 4;
NSString *bString = [cString substringWithRange:range];
// Scan values
unsigned int r, g, b;
[[NSScanner scannerWithString:rString] scanHexInt:&r];
[[NSScanner scannerWithString:gString] scanHexInt:&g];
[[NSScanner scannerWithString:bString] scanHexInt:&b];
return [UIColor colorWithRed:((float)r / 255.0f) green:((float)g / 255.0f) blue:((float)b / 255.0f) alpha:alpha];
}
+ (UIColor *)colorWithHexString:(NSString *)color{
//默认alpha值为1
return [self colorWithHexString:color alpha:1.0f];
}
@end
......@@ -96,6 +96,7 @@
#import "GYBaseModel.h"
#import <MJExtension/MJExtension.h>
#import <UMCommon/MobClick.h>
#import "UIColor+HExtension.h"
#import "IOSADManager.h" //AD
......
//
// GYRankingListModel.h
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface GYRankingListModel : GYBaseModel
@property (nonatomic, assign) NSInteger award;
@property (nonatomic, copy ) NSString * datadate;
@property (nonatomic, assign) NSInteger drip;
@property (nonatomic, copy ) NSString * headImg;
@property (nonatomic, copy ) NSString * nickname;
//@property (nonatomic, assign) NSInteger id;
//@property (nonatomic, assign) NSInteger uid;
@property (nonatomic, assign) NSInteger userRank;
@end
NS_ASSUME_NONNULL_END
//
// GYRankingListModel.m
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import "GYRankingListModel.h"
@implementation GYRankingListModel
@end
......@@ -44,6 +44,7 @@ typedef enum : NSUInteger {
cloudCheck, //云朵加速校验
task_process,// 获取福利中心进度
taskListWithStat,//获取福利中心列表和状态
rank_list, //排行榜
//
......
......@@ -92,7 +92,8 @@ static CGNetworkTools* _tools = nil;
return @"/app/v2/novel/taskListWithStat";
case taskListWithStat:
return @"/app/v1/game/task_process";
case rank_list:
return @"/app/v1/game/farm/rank_list";
default:
return @"";
}
......
//
// GYRankingHeaderView.h
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface GYRankingHeaderView : UIView
+(GYRankingHeaderView *)loadFromNib;
@property (weak, nonatomic) IBOutlet UIView *mainContentView;
@end
NS_ASSUME_NONNULL_END
//
// GYRankingHeaderView.m
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import "GYRankingHeaderView.h"
@implementation GYRankingHeaderView
+(GYRankingHeaderView *)loadFromNib {
return [[UINib nibWithNibName:@"GYRankingHeaderView" bundle:nil] instantiateWithOwner:self options:nil].firstObject;
}
- (void)awakeFromNib {
[super awakeFromNib];
self.mainContentView.layer.cornerRadius = 15;
self.mainContentView.layer.borderWidth = 2;
self.mainContentView.layer.borderColor = [UIColor colorWithHex:0x904E1A].CGColor;
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<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 clipsSubviews="YES" contentMode="scaleToFill" id="iN0-l3-epB" customClass="GYRankingHeaderView">
<rect key="frame" x="0.0" y="0.0" width="414" height="50"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LdK-dh-ill">
<rect key="frame" x="10" y="10" width="394" height="55"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="钻石" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oZ2-Ql-o18">
<rect key="frame" x="334" y="10" width="60" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="60" id="S2N-O7-A1J"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="今日金币" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hf1-vM-OIO">
<rect key="frame" x="254" y="10" width="70" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="U3R-Ha-3fv"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<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="ITS-e8-Zbr">
<rect key="frame" x="10" y="10" width="120" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="120" id="7D9-wG-NqC"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="用户" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IKN-ba-AMy">
<rect key="frame" x="130" y="10" width="31" height="18"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.8784313725490196" green="0.56862745098039214" blue="0.30196078431372547" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="ITS-e8-Zbr" firstAttribute="centerY" secondItem="oZ2-Ql-o18" secondAttribute="centerY" id="1Zs-yA-IRG"/>
<constraint firstAttribute="trailing" secondItem="oZ2-Ql-o18" secondAttribute="trailing" id="3wB-uF-Ju5"/>
<constraint firstItem="oZ2-Ql-o18" firstAttribute="leading" secondItem="hf1-vM-OIO" secondAttribute="trailing" constant="10" id="Aha-91-vgx"/>
<constraint firstItem="hf1-vM-OIO" firstAttribute="centerY" secondItem="oZ2-Ql-o18" secondAttribute="centerY" id="X21-Au-sxi"/>
<constraint firstItem="oZ2-Ql-o18" firstAttribute="top" secondItem="LdK-dh-ill" secondAttribute="top" constant="10" id="fSj-Yb-Iwp"/>
<constraint firstItem="IKN-ba-AMy" firstAttribute="centerY" secondItem="ITS-e8-Zbr" secondAttribute="centerY" id="fgz-UW-X7I"/>
<constraint firstItem="IKN-ba-AMy" firstAttribute="leading" secondItem="ITS-e8-Zbr" secondAttribute="trailing" id="h14-JT-y5s"/>
<constraint firstItem="ITS-e8-Zbr" firstAttribute="leading" secondItem="LdK-dh-ill" secondAttribute="leading" constant="10" id="jpg-tH-Jhh"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HGu-fH-3kS">
<rect key="frame" x="10" y="48" width="394" height="2"/>
<color key="backgroundColor" red="0.56470588235294117" green="0.30588235294117649" blue="0.10196078431372549" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="2" id="WNl-jk-hyg"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.96862745100000003" green="0.91764705879999997" blue="0.7725490196" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="LdK-dh-ill" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="10" id="4e6-QB-GeO"/>
<constraint firstAttribute="trailing" secondItem="LdK-dh-ill" secondAttribute="trailing" constant="10" id="FLt-W8-evb"/>
<constraint firstItem="LdK-dh-ill" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="JD7-R1-sGA"/>
<constraint firstItem="HGu-fH-3kS" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="10" id="XhE-dS-ysc"/>
<constraint firstAttribute="bottom" secondItem="LdK-dh-ill" secondAttribute="bottom" constant="-15" id="ZQG-FK-0Uk"/>
<constraint firstAttribute="bottom" secondItem="HGu-fH-3kS" secondAttribute="bottom" id="cft-HW-mBJ"/>
<constraint firstAttribute="trailing" secondItem="HGu-fH-3kS" secondAttribute="trailing" constant="10" id="rIH-dF-lrY"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="mainContentView" destination="LdK-dh-ill" id="9xL-wc-8KM"/>
</connections>
<point key="canvasLocation" x="140.57971014492756" y="-174.77678571428569"/>
</view>
</objects>
</document>
//
// GYRankingUserInfoView.h
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import <UIKit/UIKit.h>
#import "GYRankingListModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface GYRankingUserInfoView : UIView
+(GYRankingUserInfoView *)loadFromNib;
@property (weak, nonatomic) IBOutlet UIButton *rankingNumberButton;
@property (weak, nonatomic) IBOutlet UIImageView *userProfileView;
@property (weak, nonatomic) IBOutlet UILabel *nickNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *coinCountLabel;
- (void)configWithRankingListModel: (GYRankingListModel *)model;
@end
NS_ASSUME_NONNULL_END
//
// GYRankingUserInfoView.m
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import "GYRankingUserInfoView.h"
#import <UIImageView+AFNetworking.h>
@implementation GYRankingUserInfoView
+(GYRankingUserInfoView *)loadFromNib {
return [[UINib nibWithNibName:@"GYRankingUserInfoView" bundle:nil] instantiateWithOwner:self options:nil].firstObject;
}
- (void)configWithRankingListModel: (GYRankingListModel *)model {
if (model.userRank < 100) {
[self.rankingNumberButton setTitle:[NSString stringWithFormat:@"%ld", model.userRank] forState:UIControlStateNormal];
} else {
[self.rankingNumberButton setTitle: @"99+" forState:UIControlStateNormal];
}
self.nickNameLabel.text = model.nickname;
self.coinCountLabel.text = [NSString stringWithFormat:@"%ld", model.drip];
[self.userProfileView setImageWithURL:[NSURL URLWithString:model.headImg]];
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<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="GYRankingUserInfoView">
<rect key="frame" x="0.0" y="0.0" width="414" height="108"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ycr-kd-pdF">
<rect key="frame" x="10" y="10" width="394" height="60"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eVz-of-Rjc">
<rect key="frame" x="20" y="15" width="30" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="LI1-rJ-XqK"/>
<constraint firstAttribute="width" constant="30" id="kK9-yW-AsV"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
<state key="normal" title="99+">
<color key="titleColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
</state>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="今日金币" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="5vI-Wi-aak">
<rect key="frame" x="320.5" y="32" width="53.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.56470588235294117" green="0.30588235294117649" blue="0.10196078431372549" alpha="0.84705882352941175" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="永树" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Kyo-Nh-yI8">
<rect key="frame" x="120" y="19.5" width="160" height="21.5"/>
<constraints>
<constraint firstAttribute="width" constant="160" id="HeT-Gy-Z5t"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<color key="textColor" red="0.40000000000000002" green="0.30980392159999998" blue="0.19215686269999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="mWb-Pe-9dx">
<rect key="frame" x="60" y="10" width="40" height="40"/>
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="6k0-jr-V0o"/>
<constraint firstAttribute="width" constant="40" id="cgb-Wd-R6i"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="20"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oLF-fm-Xlw">
<rect key="frame" x="364" y="11" width="10" height="18"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="15"/>
<color key="textColor" red="0.56470588239999997" green="0.30588235289999999" blue="0.1019607843" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="0.93725490196078431" blue="0.78431372549019607" alpha="0.84705882352941175" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="oLF-fm-Xlw" secondAttribute="trailing" constant="20" id="3t7-FB-NXn"/>
<constraint firstItem="oLF-fm-Xlw" firstAttribute="centerY" secondItem="Ycr-kd-pdF" secondAttribute="centerY" constant="-10" id="E9L-ed-wfr"/>
<constraint firstItem="Kyo-Nh-yI8" firstAttribute="centerY" secondItem="Ycr-kd-pdF" secondAttribute="centerY" id="IoJ-LG-DNd"/>
<constraint firstItem="mWb-Pe-9dx" firstAttribute="leading" secondItem="eVz-of-Rjc" secondAttribute="trailing" constant="10" id="Ng5-15-7wD"/>
<constraint firstAttribute="height" constant="60" id="Oms-8Q-ASQ"/>
<constraint firstItem="mWb-Pe-9dx" firstAttribute="centerY" secondItem="Ycr-kd-pdF" secondAttribute="centerY" id="Vs6-8I-A3t"/>
<constraint firstItem="eVz-of-Rjc" firstAttribute="leading" secondItem="Ycr-kd-pdF" secondAttribute="leading" constant="20" id="ZK0-ab-mEu"/>
<constraint firstItem="5vI-Wi-aak" firstAttribute="trailing" secondItem="oLF-fm-Xlw" secondAttribute="trailing" id="dpg-Xy-uI5"/>
<constraint firstItem="Kyo-Nh-yI8" firstAttribute="leading" secondItem="mWb-Pe-9dx" secondAttribute="trailing" constant="20" id="kjN-13-Y9D"/>
<constraint firstItem="5vI-Wi-aak" firstAttribute="centerY" secondItem="Ycr-kd-pdF" secondAttribute="centerY" constant="10" id="mGP-r3-GJk"/>
<constraint firstItem="eVz-of-Rjc" firstAttribute="centerY" secondItem="Ycr-kd-pdF" secondAttribute="centerY" id="pjX-km-1Ne"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<integer key="value" value="5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Ycr-kd-pdF" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="10" id="Mqt-Nr-zsg"/>
<constraint firstItem="Ycr-kd-pdF" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="NmQ-fR-B7k"/>
<constraint firstAttribute="trailing" secondItem="Ycr-kd-pdF" secondAttribute="trailing" constant="10" id="Sgd-9R-L4O"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="coinCountLabel" destination="oLF-fm-Xlw" id="58T-Cx-V5n"/>
<outlet property="nickNameLabel" destination="Kyo-Nh-yI8" id="Rri-ia-QMa"/>
<outlet property="rankingNumberButton" destination="eVz-of-Rjc" id="UZ9-gv-VO5"/>
<outlet property="userProfileView" destination="mWb-Pe-9dx" id="bWp-Hu-qOx"/>
</connections>
<point key="canvasLocation" x="140.57971014492756" y="-160.04464285714286"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="systemGroupedBackgroundColor">
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
//
// GYRankingViewCell.h
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import <UIKit/UIKit.h>
#import "GYRankingListModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface GYRankingViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIButton *rankingNumberBtn;
@property (weak, nonatomic) IBOutlet UIImageView *userProfileView;
@property (weak, nonatomic) IBOutlet UILabel *nicknameLabel;
@property (weak, nonatomic) IBOutlet UILabel *coinNumberLabel;
@property (weak, nonatomic) IBOutlet UILabel *diamondLabel;
- (void)configWithRankingListModel: (GYRankingListModel *)model;
@end
NS_ASSUME_NONNULL_END
//
// GYRankingViewCell.m
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import "GYRankingViewCell.h"
#import <AFNetworking/AFNetworking.h>
#import <UIImageView+AFNetworking.h>
@implementation GYRankingViewCell
- (void)configWithRankingListModel: (GYRankingListModel *)model {
if (model.userRank <= 3) {
[self.rankingNumberBtn setImage:[UIImage imageNamed: [NSString stringWithFormat:@"ranking_%ld_icon", (long)model.userRank]] forState:UIControlStateNormal];
} else {
[self.rankingNumberBtn setImage:nil forState:UIControlStateNormal];
[self.rankingNumberBtn setTitle:[NSString stringWithFormat:@"%ld", model.userRank] forState:UIControlStateNormal];
}
self.nicknameLabel.text = model.nickname;
self.coinNumberLabel.text = [NSString stringWithFormat:@"%ld", model.drip];
self.diamondLabel.text = [NSString stringWithFormat:@"%ld钻", model.award];
[self.userProfileView setImageWithURL:[NSURL URLWithString:model.headImg]];
}
- (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
This diff is collapsed.
//
// GYRankingViewController.h
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface GYRankingViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
//
// GYRankingViewController.m
// GYDemo
//
// Created by Mazy on 2020/11/20.
//
#import "GYRankingViewController.h"
#import "GYRankingViewCell.h"
#import "GYRankingHeaderView.h"
#import "GYRankingListModel.h"
#import "GYRankingUserInfoView.h"
@interface GYRankingViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray<GYRankingListModel *> *rankList;
@property (nonatomic, strong) GYRankingListModel *userInfo;
@property (nonatomic, strong) GYRankingUserInfoView *infoView;
@end
@implementation GYRankingViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setupUI];
[self loadRankingList];
}
- (void)setupUI {
self.navigationItem.title = @"排行榜";
self.navigationController.navigationBar.barTintColor = [UIColor colorWithHex:0xE0914D];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName: [UIFont systemFontOfSize:20 weight: UIFontWeightBold]};
self.view.backgroundColor = [UIColor colorWithHex:0xF7EAC5];
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(0, 0, 50, 44);
backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
[backButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
[backButton setImage:[UIImage imageNamed:@"ranking_back_icon"] forState:UIControlStateNormal];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:(UITableViewStylePlain)];
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.rowHeight = 70;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 100, 0);
self.tableView.showsVerticalScrollIndicator = false;
self.tableView.backgroundColor = [UIColor colorWithHex:0xF7EAC5];
self.tableView.separatorStyle = UITableViewCellSelectionStyleNone;
[self.tableView registerNib:[UINib nibWithNibName:@"GYRankingViewCell" bundle:nil] forCellReuseIdentifier:@"GYRankingViewCell"];
[self.tableView registerClass:UITableViewCell.self forCellReuseIdentifier:@"cellid"];
GYRankingUserInfoView *infoView = [GYRankingUserInfoView loadFromNib];
[self.view addSubview:infoView];
[infoView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view);
make.height.mas_equalTo(SafeAreaBottomHeight + 70.0);
}];
self.infoView = infoView;
}
- (void)backAction {
[self.navigationController dismissViewControllerAnimated:true completion:nil];
}
- (void)loadRankingList {
self.rankList = [NSMutableArray array];
WEAKSELF
[[CGNetworkTools shared] getWithAction:rank_list parameters:@{} success:^(id _Nonnull response) {
NSLog(@"%@", response);
if ([[response objectForKey:@"status"] integerValue] == 200) {
NSDictionary *data = [[response objectForKey:@"result"] objectForKey:@"data"];
NSArray *dripList = [data objectForKey:@"dripLeaderboardList"];
for (NSDictionary *dict in dripList) {
GYRankingListModel *model = [[GYRankingListModel alloc] init];
[model setValuesForKeysWithDictionary:dict];
[weakSelf.rankList addObject:model];
}
NSDictionary *userInfo = [data objectForKey:@"userInfo"];
GYRankingListModel *infoModel = [[GYRankingListModel alloc] init];
[infoModel setValuesForKeysWithDictionary:userInfo];
weakSelf.userInfo = infoModel;
[weakSelf.infoView configWithRankingListModel:infoModel];
[weakSelf.tableView reloadData];
}
} failure:^(NSError * _Nonnull error) {
}];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.rankList.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
return 50;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
GYRankingHeaderView *headerView = [GYRankingHeaderView loadFromNib];
return headerView;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
GYRankingViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GYRankingViewCell"];
[cell configWithRankingListModel:self.rankList[indexPath.row]];
return cell;
}
@end
......@@ -14,17 +14,17 @@
<key>BaiduMobAd_SDK.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>11</integer>
<integer>14</integer>
</dict>
<key>Bytedance-UnionAD.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>11</integer>
</dict>
<key>GDTMobSDK.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>13</integer>
<integer>12</integer>
</dict>
<key>KSAdSDK.xcscheme_^#shared#^_</key>
<dict>
......@@ -46,7 +46,7 @@
<key>MJRefresh.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>9</integer>
<integer>13</integer>
</dict>
<key>Masonry.xcscheme</key>
<dict>
......@@ -65,12 +65,12 @@
<key>RSPodKSAdaper.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>12</integer>
<integer>7</integer>
</dict>
<key>SigmobAd-iOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>8</integer>
<integer>17</integer>
</dict>
<key>SwiftyStoreKit.xcscheme</key>
<dict>
......@@ -82,17 +82,17 @@
<key>UMCCommon.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>6</integer>
<integer>9</integer>
</dict>
<key>VLionAdSDKPoly.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>14</integer>
<integer>15</integer>
</dict>
<key>WechatOpenSDK.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>15</integer>
<integer>16</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
......
......@@ -7,12 +7,12 @@
<key>Unity-iPhone.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>16</integer>
<integer>6</integer>
</dict>
<key>UnityFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>17</integer>
<integer>8</integer>
</dict>
</dict>
</dict>
......
......@@ -5,16 +5,15 @@
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.SymbolicBreakpoint">
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "7B3C53C4-533A-4CD7-ADFC-DF88D23DFB13"
uuid = "1E41E607-21A5-45B9-BFEC-2D03EA17A998"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = ""
moduleName = "">
<Locations>
</Locations>
breakpointStackSelectionBehavior = "1"
scope = "1"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment