房间糖果树换皮的修改

This commit is contained in:
fengshuo
2023-03-10 19:05:56 +08:00
parent 1e86b60672
commit 140ad85e30
59 changed files with 2003 additions and 393 deletions

View File

@@ -885,6 +885,15 @@
E884C36F2743AAC800E1EBED /* AttachmentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E884C36E2743AAC800E1EBED /* AttachmentModel.m */; };
E884C3722743AEDE00E1EBED /* CustomAttachmentDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = E884C3712743AEDE00E1EBED /* CustomAttachmentDecoder.m */; };
E88749B6282B8FC600C3C7DB /* MonentsInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E88749B5282B8FC600C3C7DB /* MonentsInfoModel.m */; };
E887531629BB1B4F0017A41A /* candy_tree.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = E887531529BB1B4F0017A41A /* candy_tree.mp4 */; };
E887531929BB26680017A41A /* CandyTreeMoreItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E887531829BB26680017A41A /* CandyTreeMoreItemModel.m */; };
E887531D29BB26FF0017A41A /* XPSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = E887531C29BB26FF0017A41A /* XPSwitch.m */; };
E887532029BB29990017A41A /* XPCandyTreeRecordView.m in Sources */ = {isa = PBXBuildFile; fileRef = E887531E29BB29990017A41A /* XPCandyTreeRecordView.m */; };
E887532329BB29BA0017A41A /* XPCandyTreeRuleView.m in Sources */ = {isa = PBXBuildFile; fileRef = E887532129BB29BA0017A41A /* XPCandyTreeRuleView.m */; };
E887532629BB29F80017A41A /* CandyTreeGiftModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E887532429BB29F80017A41A /* CandyTreeGiftModel.m */; };
E887532929BB31F80017A41A /* XPCandyTreeRecordTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E887532729BB31F80017A41A /* XPCandyTreeRecordTableViewCell.m */; };
E887532D29BB328C0017A41A /* XPCandyTreeRuleHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = E887532C29BB328C0017A41A /* XPCandyTreeRuleHeaderView.m */; };
E887533029BB32E50017A41A /* XPCandyTreeRuleTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E887532E29BB32E40017A41A /* XPCandyTreeRuleTableViewCell.m */; };
E88863C3278E7BCC004BCFAB /* crossRoomPk_progress.svga in Resources */ = {isa = PBXBuildFile; fileRef = E88863C2278E7BCC004BCFAB /* crossRoomPk_progress.svga */; };
E88863C6278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88863C5278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m */; };
E88863C9278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m in Sources */ = {isa = PBXBuildFile; fileRef = E88863C8278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m */; };
@@ -2889,6 +2898,23 @@
E884C3712743AEDE00E1EBED /* CustomAttachmentDecoder.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomAttachmentDecoder.m; sourceTree = "<group>"; };
E88749B4282B8FC600C3C7DB /* MonentsInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MonentsInfoModel.h; sourceTree = "<group>"; };
E88749B5282B8FC600C3C7DB /* MonentsInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MonentsInfoModel.m; sourceTree = "<group>"; };
E887531529BB1B4F0017A41A /* candy_tree.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = candy_tree.mp4; sourceTree = "<group>"; };
E887531729BB26680017A41A /* CandyTreeMoreItemModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CandyTreeMoreItemModel.h; sourceTree = "<group>"; };
E887531829BB26680017A41A /* CandyTreeMoreItemModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CandyTreeMoreItemModel.m; sourceTree = "<group>"; };
E887531B29BB26FF0017A41A /* XPSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPSwitch.h; sourceTree = "<group>"; };
E887531C29BB26FF0017A41A /* XPSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPSwitch.m; sourceTree = "<group>"; };
E887531E29BB29990017A41A /* XPCandyTreeRecordView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeRecordView.m; sourceTree = "<group>"; };
E887531F29BB29990017A41A /* XPCandyTreeRecordView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeRecordView.h; sourceTree = "<group>"; };
E887532129BB29BA0017A41A /* XPCandyTreeRuleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeRuleView.m; sourceTree = "<group>"; };
E887532229BB29BA0017A41A /* XPCandyTreeRuleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeRuleView.h; sourceTree = "<group>"; };
E887532429BB29F80017A41A /* CandyTreeGiftModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CandyTreeGiftModel.m; sourceTree = "<group>"; };
E887532529BB29F80017A41A /* CandyTreeGiftModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CandyTreeGiftModel.h; sourceTree = "<group>"; };
E887532729BB31F80017A41A /* XPCandyTreeRecordTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeRecordTableViewCell.m; sourceTree = "<group>"; };
E887532829BB31F80017A41A /* XPCandyTreeRecordTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeRecordTableViewCell.h; sourceTree = "<group>"; };
E887532B29BB328C0017A41A /* XPCandyTreeRuleHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeRuleHeaderView.h; sourceTree = "<group>"; };
E887532C29BB328C0017A41A /* XPCandyTreeRuleHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeRuleHeaderView.m; sourceTree = "<group>"; };
E887532E29BB32E40017A41A /* XPCandyTreeRuleTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeRuleTableViewCell.m; sourceTree = "<group>"; };
E887532F29BB32E50017A41A /* XPCandyTreeRuleTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeRuleTableViewCell.h; sourceTree = "<group>"; };
E88863C2278E7BCC004BCFAB /* crossRoomPk_progress.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = crossRoomPk_progress.svga; sourceTree = "<group>"; };
E88863C4278EAFC3004BCFAB /* XPAcrossRoomPKResultView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKResultView.h; sourceTree = "<group>"; };
E88863C5278EAFC3004BCFAB /* XPAcrossRoomPKResultView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKResultView.m; sourceTree = "<group>"; };
@@ -4023,6 +4049,7 @@
189DD56C26DF5B5400AB55B1 /* UI */ = {
isa = PBXGroup;
children = (
E887531A29BB26FF0017A41A /* SwitchView */,
E81E09C6290F719C00A1F410 /* Adbvertise */,
E80EC74A28ACD84000D133C5 /* InputView */,
E8998D932859DD3F00C68558 /* UIViewCorner */,
@@ -7196,6 +7223,24 @@
path = Tool;
sourceTree = "<group>";
};
E887531A29BB26FF0017A41A /* SwitchView */ = {
isa = PBXGroup;
children = (
E887531B29BB26FF0017A41A /* XPSwitch.h */,
E887531C29BB26FF0017A41A /* XPSwitch.m */,
);
path = SwitchView;
sourceTree = "<group>";
};
E887532A29BB328C0017A41A /* SubViews */ = {
isa = PBXGroup;
children = (
E887532B29BB328C0017A41A /* XPCandyTreeRuleHeaderView.h */,
E887532C29BB328C0017A41A /* XPCandyTreeRuleHeaderView.m */,
);
path = SubViews;
sourceTree = "<group>";
};
E88863D0278ED4A0004BCFAB /* Timestamp */ = {
isa = PBXGroup;
children = (
@@ -7404,6 +7449,10 @@
E8A03DED276303BA0098D9EA /* Cell */ = {
isa = PBXGroup;
children = (
E887532F29BB32E50017A41A /* XPCandyTreeRuleTableViewCell.h */,
E887532E29BB32E40017A41A /* XPCandyTreeRuleTableViewCell.m */,
E887532829BB31F80017A41A /* XPCandyTreeRecordTableViewCell.h */,
E887532729BB31F80017A41A /* XPCandyTreeRecordTableViewCell.m */,
E8A03DEE276303D40098D9EA /* XPCandyTreeRankTableViewCell.h */,
E8A03DEF276303D40098D9EA /* XPCandyTreeRankTableViewCell.m */,
E8A03DF42763367F0098D9EA /* XPCandyTreeEmptyableViewCell.h */,
@@ -7446,6 +7495,11 @@
E8A1E4492761F92100B294CA /* View */ = {
isa = PBXGroup;
children = (
E887532A29BB328C0017A41A /* SubViews */,
E887532229BB29BA0017A41A /* XPCandyTreeRuleView.h */,
E887532129BB29BA0017A41A /* XPCandyTreeRuleView.m */,
E887531F29BB29990017A41A /* XPCandyTreeRecordView.h */,
E887531E29BB29990017A41A /* XPCandyTreeRecordView.m */,
E8A03DED276303BA0098D9EA /* Cell */,
E8A1E44C2761F98600B294CA /* XPCandyTreeViewController.h */,
E8A1E44D2761F98600B294CA /* XPCandyTreeViewController.m */,
@@ -7475,6 +7529,8 @@
E8A1E44B2761F93600B294CA /* Model */ = {
isa = PBXGroup;
children = (
E887532529BB29F80017A41A /* CandyTreeGiftModel.h */,
E887532429BB29F80017A41A /* CandyTreeGiftModel.m */,
E8A1E452276208E500B294CA /* CandyTreeInfoModel.h */,
E8A1E453276208E500B294CA /* CandyTreeInfoModel.m */,
E8A03DF1276328FC0098D9EA /* CandyTreeRecordModel.h */,
@@ -7483,6 +7539,8 @@
E8A03DF827634A590098D9EA /* CandyTreeResultModel.m */,
E8DEC990276441AA0078CB70 /* XPCandyTreeAnimationModel.h */,
E8DEC991276441AA0078CB70 /* XPCandyTreeAnimationModel.m */,
E887531729BB26680017A41A /* CandyTreeMoreItemModel.h */,
E887531829BB26680017A41A /* CandyTreeMoreItemModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -7490,6 +7548,7 @@
E8A1E45C276220B100B294CA /* Sources */ = {
isa = PBXGroup;
children = (
E887531529BB1B4F0017A41A /* candy_tree.mp4 */,
E839806729027D4A0084BFC8 /* room_wish_gift_sendCelebrate.svga */,
E897AC0228AF9DDE003B3587 /* sailing_prize_cowry.svga */,
E897AC0028AF6B90003B3587 /* sailing_prize.svga */,
@@ -9421,6 +9480,7 @@
E80EC82928ACD84000D133C5 /* emoji_28@2x.png in Resources */,
9B85F3502806A34B006EDF51 /* anchorPK_progress.svga in Resources */,
E80EC82028ACD84000D133C5 /* emoji_38@2x.png in Resources */,
E887531629BB1B4F0017A41A /* candy_tree.mp4 in Resources */,
E80EC8A628ACD84100D133C5 /* emoji_23@2x.png in Resources */,
E8E859DF28264D7B00EE4857 /* js in Resources */,
186A52E726FC559700D67B2C /* yw_1222_0769.jpg in Resources */,
@@ -9650,6 +9710,7 @@
E88B5CB526FB20B800DA9178 /* XPMineTeenagerPwdView.m in Sources */,
146567E229B1E1CF00A1F5B9 /* XPNewHomeHeaderView.m in Sources */,
E8E859C128264C2300EE4857 /* MyHTTPConnection.m in Sources */,
E887533029BB32E50017A41A /* XPCandyTreeRuleTableViewCell.m in Sources */,
146567E529B1F55200A1F5B9 /* XPFindNewFriendTableViewCell.m in Sources */,
9BDA3E7A27FD43EF00517FE6 /* XPAnchorFansTeamEntranceView.m in Sources */,
E81C279826EB3AC40031E639 /* LoginForgetPasswordProtocol.h in Sources */,
@@ -9871,6 +9932,7 @@
E8AB631628ADE2D20023B0D2 /* XPMonentsTopicLatestViewController.m in Sources */,
E8B846CF26FDD96100A777FE /* XPMineRechageHeadView.m in Sources */,
E852D74728633E92001465ED /* MonentsCommentReplyModel.m in Sources */,
E887532929BB31F80017A41A /* XPCandyTreeRecordTableViewCell.m in Sources */,
186A534926FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m in Sources */,
E8B3E80C2848BA40009746AB /* NewUserGreetModel.m in Sources */,
9BCB99A028F571B500466D64 /* XPMineCollectPartyRoomViewController.m in Sources */,
@@ -10234,6 +10296,7 @@
9BEBBF4629384BDE0024E0B4 /* HomeSearchHijackAwardModel.m in Sources */,
9B1B729828002147003FACE9 /* XPMineFansTeamPresenter.m in Sources */,
E86507E8281A8212006951B0 /* ContentTweetModel.m in Sources */,
E887531D29BB26FF0017A41A /* XPSwitch.m in Sources */,
E8D55CA0281186D6006935A5 /* SessionAudioRecordView.m in Sources */,
9B39C88328850EFB00564D17 /* XPHomeLiveHeadView.m in Sources */,
E8A88D2A27E81C8600CA8837 /* XPRoomPKUserCollectionViewCell.m in Sources */,
@@ -10272,6 +10335,7 @@
9BE01AE728938AB600B50299 /* XPDressUpShopCardTableViewCell.m in Sources */,
E82E75062828E76400C25EF7 /* XPCoreDataManager.m in Sources */,
9B8DE0E4289CF7AA00FB6EC2 /* XPRoomGiftCompoundView.m in Sources */,
E887532629BB29F80017A41A /* CandyTreeGiftModel.m in Sources */,
1808072D2731598F001FD836 /* XPNetImageYYLabel.m in Sources */,
E818E348286ECA4B005EDF68 /* XPMonentsPublishViewController.m in Sources */,
9B88E20C28C5EB8300D26FBA /* MessageContentRedPacketView.m in Sources */,
@@ -10335,6 +10399,7 @@
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */,
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */,
E818E34F286EDF72005EDF68 /* XPMonentsPublishCollectionViewCell.m in Sources */,
E887532029BB29990017A41A /* XPCandyTreeRecordView.m in Sources */,
14C1F15429B86DF0000A960F /* XPMineMoreTableViewCell.m in Sources */,
E877A7EE278428FB00EFACED /* MicroDatingProgressView.m in Sources */,
E8E0DAE9285C2E8C00566A2F /* FindNewGreetMessageModel.m in Sources */,
@@ -10421,6 +10486,7 @@
E80487652717DDD9008595F2 /* XPRoomMenuItem.m in Sources */,
E895018C282D0701007E459A /* XPMoentsTopicView.m in Sources */,
E8A353A028FE84670014A784 /* XPWishGiftInfoView.m in Sources */,
E887532D29BB328C0017A41A /* XPCandyTreeRuleHeaderView.m in Sources */,
E89BD7D4277D471100E31B19 /* XPRoomOnlineTableViewCell.m in Sources */,
E8412F9627795E34006E1101 /* XPRoomInviteFansView.m in Sources */,
E80CBDE627D0C1CF001E1EC2 /* HomeMenuSourceModel.m in Sources */,
@@ -10450,6 +10516,7 @@
E84843B227F5A0740050D365 /* XPRomPKResultTitleLabel.m in Sources */,
E8C6FFEA2755040B004DC9F0 /* XPHomeSearchNavView.m in Sources */,
E80EC80F28ACD84000D133C5 /* QEmotion.m in Sources */,
E887531929BB26680017A41A /* CandyTreeMoreItemModel.m in Sources */,
E8E859C628264C2300EE4857 /* HTTPAsyncFileResponse.m in Sources */,
E877A7EB2783E24700EFACED /* DatingStageView.m in Sources */,
9BD2ECDA288F867000F5CD9A /* XPMineFootPrintTableViewCell.m in Sources */,
@@ -10486,6 +10553,7 @@
E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */,
9B0086C627BA392B0032BD2B /* AnchorStageView.m in Sources */,
9BCD02C72796C02800F396AA /* MicroNobleWaveView.m in Sources */,
E887532329BB29BA0017A41A /* XPCandyTreeRuleView.m in Sources */,
9B73CD09279A9AA2006AF255 /* XPSkillCardUpdatePropModel.m in Sources */,
E874B88827215D39003954B9 /* MicroStateModel.m in Sources */,
E877A7F427842EF800EFACED /* XPRoomDatingVipUpMicView.m in Sources */,

View File

@@ -39,7 +39,7 @@ UIKIT_EXTERN NSString * adImageName;
[self configUMengSDK];
[self initEmojiData];
[self configBugly];
[self configQIYUSDK];
// [self configQIYUSDK];
}
- (void)configShareSDK {

View File

@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "room_candy_tree_header@2x.png",
"filename" : "candy_tree_rule_star@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_candy_tree_header@3x.png",
"filename" : "candy_tree_rule_star@3x.png",
"idiom" : "universal",
"scale" : "3x"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "room_candy_tree_back @2x.png",
"filename" : "room_candy_tree_back@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_candy_tree_back @3x.png",
"filename" : "room_candy_tree_back@3x.png",
"idiom" : "universal",
"scale" : "3x"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_candy_tree_content_back@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_candy_tree_content_back@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,38 @@
//
// XPSwitch.h
// xplan-ios
//
// Created by 冯硕 on 2023/2/9.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef enum {
CHSwitchShapeOval,
CHSwitchShapeRectangle,
CHSwitchShapeRectangleNoCorner
} CHSwitchShape;
@interface XPSwitch : UIControl<UIGestureRecognizerDelegate>
/** 开关状态读取与设置 */
@property (nonatomic, getter = isOn) BOOL on;
/** 开关形状枚举值默认CHSwitchShapeOval */
@property (nonatomic, assign) CHSwitchShape shape;
/** 打开时的颜色 */
@property (nonatomic, strong) UIColor *onTintColor;
/** 关闭时的颜色 */
@property (nonatomic, strong) UIColor *tintColor;
/** 圆点颜色 */
@property (nonatomic, strong) UIColor *thumbTintColor;
/** 是否需要阴影效果 */
@property (nonatomic, assign) BOOL shadow;
/** 关闭时的阴影颜色 */
@property (nonatomic, strong) UIColor *tintBorderColor;
/** 打开时的阴影颜色 */
@property (nonatomic, strong) UIColor *onTintBorderColor;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,372 @@
//
// XPSwitch.m
// xplan-ios
//
// Created by on 2023/2/9.
//
#import "XPSwitch.h"
#import <QuartzCore/QuartzCore.h>
static const CGFloat kAnimateDuration = 0.3f;
static const CGFloat kHorizontalAdjustment = 3.0f;
static const CGFloat kRectShapeCornerRadius = 4.0f;
static const CGFloat kThumbShadowOpacity = 0.3f;
static const CGFloat kThumbShadowRadius = 0.5f;
static const CGFloat kSwitchBorderWidth = 1.75f;
@interface XPSwitch ()
@property (nonatomic, strong) UIView *onBackgroundView;
@property (nonatomic, strong) UIView *offBackgroundView;
@property (nonatomic, strong) UIView *thumbView;
@end
@implementation XPSwitch
@synthesize onBackgroundView = _onBackgroundView;
@synthesize offBackgroundView = _offBackgroundView;
@synthesize thumbView = _thumbView;
@synthesize on = _on;
@synthesize shape = _shape;
@synthesize onTintColor = _onTintColor;
@synthesize tintColor = _tintColor;
@synthesize thumbTintColor = _thumbTintColor;
@synthesize shadow = _shadow;
@synthesize onTintBorderColor = _onTintBorderColor;
@synthesize tintBorderColor = _tintBorderColor;
#pragma mark - View
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self setupUI];
}
return self;
}
- (void) awakeFromNib {
[super awakeFromNib];
[self setupUI];
}
- (void)setupUI {
self.shape = CHSwitchShapeOval;
[self setBackgroundColor:[UIColor clearColor]];
// Background view for ON
self.onBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
[self.onBackgroundView setBackgroundColor:[UIColor colorWithRed:(19.0f/255.0f) green:(121.0f/255.0f) blue:(208.0f/255.0f) alpha:1.0f]];
[self.onBackgroundView.layer setCornerRadius:self.frame.size.height/2];
[self.onBackgroundView.layer setShouldRasterize:YES];
[self.onBackgroundView.layer setRasterizationScale:[UIScreen mainScreen].scale];
[self addSubview:self.onBackgroundView];
// Background view for OFF
self.offBackgroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
[self.offBackgroundView setBackgroundColor:[UIColor whiteColor]];
[self.offBackgroundView.layer setCornerRadius:self.frame.size.height/2];
[self.offBackgroundView.layer setShouldRasterize:YES];
[self.offBackgroundView.layer setRasterizationScale:[UIScreen mainScreen].scale];
[self addSubview:self.offBackgroundView];
// Round switch view
self.thumbView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.height-kHorizontalAdjustment, self.frame.size.height-kHorizontalAdjustment)];
[self.thumbView setBackgroundColor:[UIColor whiteColor]];
[self.thumbView setUserInteractionEnabled:YES];
[self.thumbView.layer setCornerRadius:(self.frame.size.height-kHorizontalAdjustment)/2];
[self.thumbView.layer setShadowOffset:CGSizeMake(0, 1)];
[self.thumbView.layer setShouldRasterize:YES];
[self.thumbView.layer setShadowOpacity:kThumbShadowOpacity];
[self.thumbView.layer setRasterizationScale:[UIScreen mainScreen].scale];
[self addSubview:self.thumbView];
self.shadow = YES;
// Default to OFF position
[self.thumbView setCenter:CGPointMake(self.thumbView.frame.size.width/2, self.frame.size.height/2)];
// Handle Thumb Tap Gesture
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSwitchTap:)];
[tapGestureRecognizer setDelegate:self];
[self.thumbView addGestureRecognizer:tapGestureRecognizer];
// Handle Background Tap Gesture
UITapGestureRecognizer *tapBgGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleBgTap:)];
[tapBgGestureRecognizer setDelegate:self];
[self addGestureRecognizer:tapBgGestureRecognizer];
// Handle Thumb Pan Gesture
UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[panGestureRecognizer setDelegate:self];
[self.thumbView addGestureRecognizer:panGestureRecognizer];
[self setOn:NO];
}
#pragma mark - Accessor
- (BOOL)isOn {
return _on;
}
- (void)setOn:(BOOL)on {
if (_on != on)
_on = on;
if (_on) {
[self.onBackgroundView setAlpha:1.0];
self.offBackgroundView.transform = CGAffineTransformMakeScale(0.0, 0.0);
self.thumbView.center = CGPointMake(self.onBackgroundView.frame.size.width - (self.thumbView.frame.size.width + kHorizontalAdjustment)/2, self.thumbView.center.y);
}
else {
[self.onBackgroundView setAlpha:0.0];
self.offBackgroundView.transform = CGAffineTransformMakeScale(1.0, 1.0);
self.thumbView.center = CGPointMake((self.thumbView.frame.size.width+kHorizontalAdjustment)/2, self.thumbView.center.y);
}
}
- (void)setOnTintColor:(UIColor *)color
{
if (_onTintColor != color)
_onTintColor = color;
[self.onBackgroundView setBackgroundColor:color];
}
- (void)setOnTintBorderColor:(UIColor *)color
{
if (_onTintBorderColor != color)
_onTintBorderColor = color;
[self.onBackgroundView.layer setBorderColor:color.CGColor];
if (color)
[self.onBackgroundView.layer setBorderWidth:kSwitchBorderWidth];
else
[self.onBackgroundView.layer setBorderWidth:0.0];
}
- (void)setTintColor:(UIColor *)color
{
if (_tintColor != color)
_tintColor = color;
[self.offBackgroundView setBackgroundColor:color];
}
- (void)setTintBorderColor:(UIColor *)color
{
if (_tintBorderColor != color)
_tintBorderColor = color;
[self.offBackgroundView.layer setBorderColor:color.CGColor];
if (color)
[self.offBackgroundView.layer setBorderWidth:kSwitchBorderWidth];
else
[self.offBackgroundView.layer setBorderWidth:0.0];
}
- (void)setThumbTintColor:(UIColor *)color
{
if (_thumbTintColor != color)
_thumbTintColor = color;
[self.thumbView setBackgroundColor:color];
}
- (void)setShape:(CHSwitchShape)newShape
{
if (_shape != newShape)
_shape = newShape;
if (newShape == CHSwitchShapeOval)
{
[self.onBackgroundView.layer setCornerRadius:self.frame.size.height/2];
[self.offBackgroundView.layer setCornerRadius:self.frame.size.height/2];
[self.thumbView.layer setCornerRadius:(self.frame.size.height-kHorizontalAdjustment)/2];
}
else if (newShape == CHSwitchShapeRectangle)
{
[self.onBackgroundView.layer setCornerRadius:kRectShapeCornerRadius];
[self.offBackgroundView.layer setCornerRadius:kRectShapeCornerRadius];
[self.thumbView.layer setCornerRadius:kRectShapeCornerRadius];
}
else if (newShape == CHSwitchShapeRectangleNoCorner)
{
[self.onBackgroundView.layer setCornerRadius:0];
[self.offBackgroundView.layer setCornerRadius:0];
[self.thumbView.layer setCornerRadius:0];
}
}
- (void)setShadow:(BOOL)showShadow
{
if (_shadow != showShadow)
_shadow = showShadow;
if (showShadow)
{
[self.thumbView.layer setShadowOffset:CGSizeMake(0, 1)];
[self.thumbView.layer setShadowRadius:kThumbShadowRadius];
[self.thumbView.layer setShadowOpacity:kThumbShadowOpacity];
}
else
{
[self.thumbView.layer setShadowRadius:0.0];
[self.thumbView.layer setShadowOpacity:0.0];
}
}
#pragma mark - Animation
- (void)animateToDestination:(CGPoint)centerPoint withDuration:(CGFloat)duration switch:(BOOL)on
{
[UIView animateWithDuration:duration
delay:0.0f
options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.thumbView.center = centerPoint;
if (on)
{
[self.onBackgroundView setAlpha:1.0];
}
else
{
[self.onBackgroundView setAlpha:0.0];
}
}
completion:^(BOOL finished) {
if (finished)
{
[self updateSwitch:on];
}
}];
[UIView animateWithDuration:duration
delay:0.075f
options:UIViewAnimationOptionCurveEaseOut
animations:^{
if (on)
{
self.offBackgroundView.transform = CGAffineTransformMakeScale(0.0, 0.0);
}
else
{
self.offBackgroundView.transform = CGAffineTransformMakeScale(1.0, 1.0);
}
}
completion:^(BOOL finished) {
}];
}
#pragma mark - Gesture Recognizers
- (void)handlePan:(UIPanGestureRecognizer *)recognizer
{
CGPoint translation = [recognizer translationInView:self.thumbView];
// Check the new center to see if within the boud
CGPoint newCenter = CGPointMake(recognizer.view.center.x + translation.x,
recognizer.view.center.y);
if (newCenter.x < (recognizer.view.frame.size.width+kHorizontalAdjustment)/2 || newCenter.x > self.onBackgroundView.frame.size.width-(recognizer.view.frame.size.width+kHorizontalAdjustment)/2)
{
// New center is Out of bound. Animate to left or right position
if(recognizer.state == UIGestureRecognizerStateBegan ||
recognizer.state == UIGestureRecognizerStateChanged)
{
CGPoint velocity = [recognizer velocityInView:self.thumbView];
if (velocity.x >= 0)
{
// Animate move to right
[self animateToDestination:CGPointMake(self.onBackgroundView.frame.size.width - (self.thumbView.frame.size.width+kHorizontalAdjustment)/2, recognizer.view.center.y) withDuration:kAnimateDuration switch:YES];
}
else
{
// Animate move to left
[self animateToDestination:CGPointMake((self.thumbView.frame.size.width+kHorizontalAdjustment)/2, recognizer.view.center.y) withDuration:kAnimateDuration switch:NO];
}
}
return;
}
// Only allow vertical pan
recognizer.view.center = CGPointMake(recognizer.view.center.x + translation.x,
recognizer.view.center.y);
[recognizer setTranslation:CGPointMake(0, 0) inView:self.thumbView];
CGPoint velocity = [recognizer velocityInView:self.thumbView];
if(recognizer.state == UIGestureRecognizerStateEnded)
{
if (velocity.x >= 0)
{
if (recognizer.view.center.x < self.onBackgroundView.frame.size.width - (self.thumbView.frame.size.width+kHorizontalAdjustment)/2)
{
// Animate move to right
[self animateToDestination:CGPointMake(self.onBackgroundView.frame.size.width - (self.thumbView.frame.size.width+kHorizontalAdjustment)/2, recognizer.view.center.y) withDuration:kAnimateDuration switch:YES];
}
}
else
{
// Animate move to left
[self animateToDestination:CGPointMake((self.thumbView.frame.size.width+kHorizontalAdjustment)/2, recognizer.view.center.y) withDuration:kAnimateDuration switch:NO];
}
}
}
- (void)handleSwitchTap:(UIPanGestureRecognizer *)recognizer
{
if (recognizer.state == UIGestureRecognizerStateEnded)
{
if (self.isOn)
{
// Animate move to left
[self animateToDestination:CGPointMake((self.thumbView.frame.size.width+kHorizontalAdjustment)/2, recognizer.view.center.y) withDuration:kAnimateDuration switch:NO];
}
else
{
// Animate move to right
[self animateToDestination:CGPointMake(self.onBackgroundView.frame.size.width - (self.thumbView.frame.size.width+kHorizontalAdjustment)/2, recognizer.view.center.y) withDuration:kAnimateDuration switch:YES];
}
}
}
- (void)handleBgTap:(UIPanGestureRecognizer *)recognizer
{
if (recognizer.state == UIGestureRecognizerStateEnded)
{
if (self.isOn)
{
// Animate move to left
[self animateToDestination:CGPointMake((self.thumbView.frame.size.width+kHorizontalAdjustment)/2, self.thumbView.center.y) withDuration:kAnimateDuration switch:NO];
}
else
{
// Animate move to right
[self animateToDestination:CGPointMake(self.onBackgroundView.frame.size.width - (self.thumbView.frame.size.width+kHorizontalAdjustment)/2, self.thumbView.center.y) withDuration:kAnimateDuration switch:YES];
}
}
}
#pragma mark -
- (void)updateSwitch:(BOOL)on
{
if (_on != on)
_on = on;
[self sendActionsForControlEvents:UIControlEventValueChanged];
}
@end

View File

@@ -34,11 +34,11 @@
}
/// #FFFFFF
+ (UIColor *)giftSegmentNormalTitleColor {
return UIColorRGBAlpha(0xFFFFFF, 1);
return UIColorRGBAlpha(0xBDBFD0, 1);
}
/// #5FCCE4
+ (UIColor *)giftSegmentSelectTitleColor {
return UIColorRGBAlpha(0x5FCCE4, 1);
return UIColorRGBAlpha(0xFFE710, 1);
}
/// 0x#5FCCE4
+ (UIColor *)giftNameSelectColor {

View File

@@ -37,6 +37,20 @@ NS_ASSUME_NONNULL_BEGIN
page:(NSString *)page
pageSize:(NSString *)pageSize
datetype:(NSString *)datetype;
/// 获奖记录
/// @param completion 完成
/// @param page 页数
/// @param pageSize 大小
/// @param uid uid
/// @param sortType 排序方式:按时间:time,按价值:worth
+ (void)candyTreeDrawrecord:(HttpRequestHelperCompletion)completion page:(NSString *)page pageSize:(NSString *)pageSize uid:(NSString *)uid sortType:(NSString *)sortType;
/// 玩法规则
/// @param completion 完成
/// @param boxType 类型 2
+ (void)candyTreeOpenRule:(HttpRequestHelperCompletion)completion boxType:(NSString *)boxType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -37,4 +37,21 @@
[self makeRequest:@"box/rankings" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, page, pageSize, datetype, nil];
}
///
/// @param completion
/// @param page
/// @param pageSize
/// @param uid uid
/// @param sortType :time,:worth
+ (void)candyTreeDrawrecord:(HttpRequestHelperCompletion)completion page:(NSString *)page pageSize:(NSString *)pageSize uid:(NSString *)uid sortType:(NSString *)sortType {
[self makeRequest:@"box/drawrecord" method:HttpRequestHelperMethodGET completion:completion,__FUNCTION__, page, pageSize, uid, sortType, nil];
}
///
/// @param completion
/// @param boxType 2
+ (void)candyTreeOpenRule:(HttpRequestHelperCompletion)completion boxType:(NSString *)boxType {
[self makeRequest:@"box/getOpenBoxRule" method:HttpRequestHelperMethodGET completion:completion,__FUNCTION__, boxType, nil];
}
@end

View File

@@ -0,0 +1,30 @@
//
// CandyTreeGiftModel.h
// xplan-ios
//
// Created by 冯硕 on 2023/2/3.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface CandyTreeGiftModel : NSObject
///时间戳
@property (nonatomic,copy) NSString *createTime;
///奖励地址
@property (nonatomic,copy) NSString *prizeImgUrl;
///奖励名称
@property (nonatomic,copy) NSString *prizeName;
///礼物个数
@property (nonatomic,assign) NSInteger prizeNum;
///概率
@property (nonatomic,assign) CGFloat showRate;
///礼物价值
@property (nonatomic,copy) NSString *platformValue;
///奖励链接
@property (nonatomic,copy) NSString *prizeUrl;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// CandyTreeGiftModel.m
// xplan-ios
//
// Created by on 2023/2/3.
//
#import "CandyTreeGiftModel.h"
@implementation CandyTreeGiftModel
@end

View File

@@ -0,0 +1,35 @@
//
// CandyTreeMoreItemModel.h
// xplan-ios
//
// Created by 冯硕 on 2023/3/10.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, CandyTreeMoreItemType) {
///购买
CandyTreeMoreItemType_Buy,
///记录
CandyTreeMoreItemType_Record,
///规则
CandyTreeMoreItemType_Rule,
///开关
CandyTreeMoreItemType_Switch
};
@interface CandyTreeMoreItemModel : NSObject
///类型
@property (nonatomic,assign) CandyTreeMoreItemType type;
///标题
@property (nonatomic,copy) NSString *title;
///状态
@property (nonatomic,assign) BOOL switchState;
///是否可用
@property (nonatomic,assign) BOOL switchEnable;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,12 @@
//
// CandyTreeMoreItemModel.m
// xplan-ios
//
// Created by on 2023/3/10.
//
#import "CandyTreeMoreItemModel.h"
@implementation CandyTreeMoreItemModel
@end

View File

@@ -27,7 +27,7 @@
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor whiteColor];
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.emptyImageView];
[self.contentView addSubview:self.titleLabel];

View File

@@ -9,7 +9,7 @@
NS_ASSUME_NONNULL_BEGIN
@class XPCandyTreeMoreRuleCell;
@class XPCandyTreeMoreRuleCell, CandyTreeMoreItemModel;
@protocol XPCandyTreeMoreRuleCellDelegate <NSObject>
- (void)xPCandyTreeMoreRuleCell:(XPCandyTreeMoreRuleCell *)cell switchChange:(UISwitch *)change;
@@ -17,14 +17,10 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface XPCandyTreeMoreRuleCell : UITableViewCell
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) BOOL isShow;
///是否可以切换
@property (nonatomic,assign) BOOL isSwitchEnable;
///等级
@property (nonatomic,assign) NSInteger sendMessageSwitchLevel;
@property (nonatomic, weak) id<XPCandyTreeMoreRuleCellDelegate> delegate;
@property (nonatomic,strong) CandyTreeMoreItemModel *itemModel;
@end

View File

@@ -10,99 +10,154 @@
#import <Masonry/Masonry.h>
#import "ThemeColor.h"
#import "XCHUDTool.h"
#import "CandyTreeMoreItemModel.h"
#import "XPSwitch.h"
@interface XPCandyTreeMoreRuleCell ()
///
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic, strong) UISwitch *switchButton;
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) UIView *switchView;
@property (nonatomic, strong) XPSwitch *switchButton;
@property (nonatomic,strong) UIButton *disableButton;
///
@property (nonatomic,strong) UIImageView *arrowImageView;
///线
@property (nonatomic,strong) UIView *lineView;
@end
@implementation XPCandyTreeMoreRuleCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor whiteColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.switchButton];
[self.contentView addSubview:self.disableButton];
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.stackView];
[self.contentView addSubview:self.lineView];
[self.stackView addArrangedSubview:self.switchView];
[self.stackView addArrangedSubview:self.arrowImageView];
[self.switchView addSubview:self.switchButton];
[self.switchView addSubview:self.disableButton];
}
- (void)initSubViewConstraints {
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(16);
}];
[self.switchButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(-16);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.contentView).offset(-7);
make.left.mas_equalTo(16);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.titleLabel);
make.right.mas_equalTo(self.contentView).offset(-15);
}];
[self.switchView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(30);
make.width.mas_equalTo(30);
}];
[self.switchButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.centerY.mas_equalTo(self.switchView);
make.size.mas_equalTo(CGSizeMake(38, 18));
}];
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(5.5, 10));
}];
[self.disableButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.switchButton);
}];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.contentView).inset(15);
make.bottom.mas_equalTo(self.contentView);
make.height.mas_equalTo(0.5);
}];
}
- (void)switchDidChange:(UISwitch *)switchButton {
if (self.isSwitchEnable && self.delegate && [self.delegate respondsToSelector:@selector(xPCandyTreeMoreRuleCell:switchChange:)]) {
[self.delegate xPCandyTreeMoreRuleCell:self switchChange:switchButton];
}
if (switchButton.on) {
_switchButton.thumbTintColor = [ThemeColor colorWithHexString:@"#f8cbff"];
} else {
_switchButton.thumbTintColor = [ThemeColor colorWithHexString:@"#6e31c8"];
}
if (self.itemModel.switchEnable && self.delegate && [self.delegate respondsToSelector:@selector(xPCandyTreeMoreRuleCell:switchChange:)]) {
[self.delegate xPCandyTreeMoreRuleCell:self switchChange:switchButton];
}
}
- (void)disableButtonAction:(UIButton *)sender {
if (!self.isSwitchEnable && self.sendMessageSwitchLevel > 0) {
if (!self.itemModel.switchEnable && self.sendMessageSwitchLevel > 0) {
[XCHUDTool showErrorWithMessage:[NSString stringWithFormat:@"财富值达到%ld级可用快去升级吧~", self.sendMessageSwitchLevel]];
}
}
#pragma mark - Getters And Setters
- (void)setTitle:(NSString *)title {
self.titleLabel.text = title;
}
- (void)setIsShow:(BOOL)isShow {
self.switchButton.on = isShow;
}
- (void)setIsSwitchEnable:(BOOL)isSwitchEnable {
_isSwitchEnable = isSwitchEnable;
if (_isSwitchEnable) {
[self.switchButton setOnTintColor:[ThemeColor appMainColor]];
self.disableButton.hidden = YES;
} else {
[self.switchButton setOnTintColor:[ThemeColor disableButtonColor]];
self.switchButton.on = NO;
self.disableButton.hidden = NO;
- (void)setItemModel:(CandyTreeMoreItemModel *)itemModel {
_itemModel = itemModel;
if (_itemModel) {
self.titleLabel.text = _itemModel.title;
if (_itemModel.type == CandyTreeMoreItemType_Switch) {
self.switchView.hidden = NO;
self.arrowImageView.hidden = YES;
self.switchButton.on = _itemModel.switchState;
if (_itemModel.switchEnable) {
self.disableButton.hidden = YES;
} else {
self.switchButton.on = NO;
self.disableButton.hidden = NO;
}
if (_switchButton.on) {
_switchButton.thumbTintColor = [ThemeColor colorWithHexString:@"#f8cbff"];
} else {
_switchButton.thumbTintColor = [ThemeColor colorWithHexString:@"#6e31c8"];
}
} else {
self.switchView.hidden = YES;
self.arrowImageView.hidden = NO;
}
}
}
- (UISwitch *)switchButton {
if (!_switchButton) {
_switchButton = [[UISwitch alloc] init];
[_switchButton addTarget:self action:@selector(switchDidChange:) forControlEvents:UIControlEventValueChanged];
}
return _switchButton;
- (XPSwitch *)switchButton {
if (!_switchButton) {
_switchButton = [[XPSwitch alloc] initWithFrame:CGRectMake(0, 0, 38, 18)];
_switchButton.backgroundColor = [UIColor clearColor];
_switchButton.onTintColor = [ThemeColor colorWithHexString:@"#490dad"];
_switchButton.tintColor = [ThemeColor colorWithHexString:@"#490dad"];
_switchButton.thumbTintColor = [ThemeColor colorWithHexString:@"#6e31c8"];
_switchButton.shadow = NO;
[_switchButton addTarget:self action:@selector(switchDidChange:) forControlEvents:UIControlEventValueChanged];
}
return _switchButton;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:15];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [ThemeColor alertTitleColor];
}
return _titleLabel;
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:11];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [ThemeColor colorWithHexString:@"#F8CBFF"];
_titleLabel.backgroundColor = [UIColor clearColor];
}
return _titleLabel;
}
- (UIButton *)disableButton {
@@ -113,4 +168,39 @@
return _disableButton;
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisHorizontal;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentCenter;
_stackView.spacing = 0;
}
return _stackView;
}
- (UIView *)switchView {
if (!_switchView) {
_switchView = [[UIView alloc] init];
_switchView.backgroundColor = [UIColor clearColor];
}
return _switchView;
}
- (UIImageView *)arrowImageView {
if (!_arrowImageView) {
_arrowImageView = [[UIImageView alloc] init];
_arrowImageView.userInteractionEnabled = YES;
_arrowImageView.image = [UIImage imageNamed:@"candy_tree_arrow"];
}
return _arrowImageView;
}
- (UIView *)lineView {
if (!_lineView) {
_lineView = [[UIView alloc] init];
_lineView.backgroundColor = UIColorRGBAlpha(0xEDEDED, 0.2);
}
return _lineView;
}
@end

View File

@@ -14,22 +14,16 @@
///Model
#import "CandyTreeRecordModel.h"
@interface XPCandyTreeRankTableViewCell ()
///
@property (nonatomic, strong) UIImageView *rankImageView;
///
@property (nonatomic, strong) UILabel *rankLabel;
///
@property (nonatomic, strong) NetImageView *avatarImageView;
///
@property (nonatomic, strong) UIImageView *genderImageView;
///
@property (nonatomic, strong) UILabel *nickNameLabel;
///
@property (nonatomic, strong) UILabel *coinNumberLabel;
///
@property (nonatomic, strong) UIImageView *coinImageView;
///线
@property (nonatomic, strong) UIView *sepView;
@end
@implementation XPCandyTreeRankTableViewCell
@@ -44,95 +38,64 @@
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor whiteColor];
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.rankImageView];
[self.contentView addSubview:self.rankLabel];
[self.contentView addSubview:self.avatarImageView];
[self.contentView addSubview:self.nickNameLabel];
[self.contentView addSubview:self.coinNumberLabel];
[self.contentView addSubview:self.coinImageView];
[self.contentView addSubview:self.sepView];
}
- (void)initSubViewConstraints {
[self.rankLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.width.mas_equalTo(26);
make.centerY.mas_equalTo(self);
}];
[self.rankImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.rankLabel);
make.width.mas_equalTo(21);
make.height.mas_equalTo(20);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.width.height.mas_equalTo(46);
make.left.mas_equalTo(self.rankLabel.mas_right).offset(10);
make.left.mas_equalTo(self.contentView).offset(35);
}];
[self.nickNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(10);
make.centerY.mas_equalTo(self.avatarImageView);
make.right.mas_lessThanOrEqualTo(self.coinNumberLabel.mas_left).offset(-5);
make.right.mas_lessThanOrEqualTo(self.coinImageView.mas_left).offset(-5);
}];
[self.coinImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-15);
make.right.mas_equalTo(self.contentView).offset(-66);
make.centerY.mas_equalTo(self.avatarImageView.mas_centerY);
make.width.mas_equalTo(18);
make.height.mas_equalTo(15);
}];
[self.coinNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.coinImageView.mas_left).offset(-3);
make.left.mas_equalTo(self.coinImageView.mas_right).offset(3);
make.centerY.mas_equalTo(self.avatarImageView);
make.left.mas_equalTo(self.nickNameLabel.mas_right).offset(10);
}];
[self.sepView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(5);
make.left.mas_equalTo(self.nickNameLabel.mas_left);
make.right.mas_equalTo(-15);
make.height.mas_equalTo(0.5);
}];
}
#pragma mark - Getters And Setters
- (void)setRoomRankModel:(CandyTreeRecordModel *)roomRankModel {
_roomRankModel = roomRankModel;
NSString *rankImage = [NSString stringWithFormat:@"room_candytree_wish_num%d", _roomRankModel.ranking.intValue];
if (roomRankModel.ranking.intValue <= 3) {
self.rankImageView.image = [UIImage imageNamed:rankImage];
self.rankImageView.hidden = NO;
self.rankLabel.hidden = YES;
}else {
self.rankLabel.text = _roomRankModel.ranking;
self.rankImageView.hidden = YES;
self.rankLabel.hidden = NO;
}
NSString *rankImage = [NSString stringWithFormat:@"%d", _roomRankModel.ranking.intValue];
self.rankLabel.text = _roomRankModel.ranking;
self.coinNumberLabel.text = roomRankModel.amount;
self.avatarImageView.imageUrl = _roomRankModel.avatar;
self.nickNameLabel.text = _roomRankModel.nick;;
}
- (UIImageView *)rankImageView {
if (!_rankImageView) {
_rankImageView = [[UIImageView alloc] init];
}
return _rankImageView;
}
- (UILabel *)rankLabel {
if (!_rankLabel) {
_rankLabel = [[UILabel alloc] init];
_rankLabel.font = [UIFont systemFontOfSize:13];
_rankLabel.font = [UIFont systemFontOfSize:16];
_rankLabel.textAlignment = NSTextAlignmentCenter;
_rankLabel.textColor = UIColorFromRGB(0x666666);
_rankLabel.textColor = [UIColor whiteColor];
}
return _rankLabel;
}
@@ -150,20 +113,12 @@
}
- (UIImageView *)genderImageView {
if (!_genderImageView) {
_genderImageView = [[UIImageView alloc] init];
_genderImageView.hidden = YES;
[_genderImageView setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
return _genderImageView;
}
- (UILabel *)nickNameLabel {
if (!_nickNameLabel) {
_nickNameLabel = [[UILabel alloc] init];
_nickNameLabel.font = [UIFont systemFontOfSize:15];
_nickNameLabel.textColor = [ThemeColor candyTreeNickColor];
_nickNameLabel.textColor = [UIColor whiteColor];
}
return _nickNameLabel;
}
@@ -173,7 +128,7 @@
if (!_coinNumberLabel) {
_coinNumberLabel = [[UILabel alloc] init];
_coinNumberLabel.font = [UIFont systemFontOfSize:15];
_coinNumberLabel.textColor = [ThemeColor candyTreeDiamondColor];
_coinNumberLabel.textColor = [ThemeColor colorWithHexString:@"#FFD477"];
_coinNumberLabel.textAlignment = NSTextAlignmentRight;
[_coinNumberLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
}
@@ -188,13 +143,5 @@
return _coinImageView;
}
- (UIView *)sepView {
if (!_sepView) {
_sepView = [UIView new];
_sepView.backgroundColor = [ThemeColor candyTreeDividerColor];
}
return _sepView;
}
@end

View File

@@ -0,0 +1,17 @@
//
// XPCandyTreeRecordTableViewCell.h
// xplan-ios
//
// Created by 冯硕 on 2023/2/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class CandyTreeGiftModel;
@interface XPCandyTreeRecordTableViewCell : UITableViewCell
///奖励信息
@property (nonatomic,strong) CandyTreeGiftModel *prizeInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,119 @@
//
// XPCandyTreeRecordTableViewCell.m
// xplan-ios
//
// Created by on 2023/2/3.
//
#import "XPCandyTreeRecordTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NetImageView.h"
///Model
#import "CandyTreeGiftModel.h"
@interface XPCandyTreeRecordTableViewCell ()
///
@property (nonatomic,strong) NetImageView *giftImageView;
///
@property (nonatomic,strong) UILabel *giftLabel;
///
@property (nonatomic,strong) UILabel *timeLabel;
@end
@implementation XPCandyTreeRecordTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.giftImageView];
[self.contentView addSubview:self.giftLabel];
[self.contentView addSubview:self.timeLabel];
}
- (void)initSubViewConstraints {
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.width.height.mas_equalTo(44);
make.left.mas_equalTo(self.contentView).offset(15);
}];
[self.giftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.giftImageView.mas_right).offset(4);
make.centerY.mas_equalTo(self.contentView);
make.right.mas_lessThanOrEqualTo(self.timeLabel.mas_left).offset(-5);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.contentView).offset(-7);
make.centerY.mas_equalTo(self.contentView);
}];
}
- (NSString *)getDateWitMMDDHHSS:(NSString *)time {
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
formatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"MM-dd HH:mm"];
//
NSString * times = time;
NSDate* date = [NSDate dateWithTimeIntervalSince1970:[times longLongValue]/ 1000.0];
NSString* dateString = [formatter stringFromDate:date];
return dateString;
}
#pragma mark - Getters And Setters
- (void)setPrizeInfo:(CandyTreeGiftModel *)prizeInfo {
_prizeInfo = prizeInfo;
if (_prizeInfo) {
self.giftImageView.imageUrl = _prizeInfo.prizeImgUrl;
self.giftLabel.text = _prizeInfo.prizeName;
self.timeLabel.text = [self getDateWitMMDDHHSS:_prizeInfo.createTime];
}
}
- (NetImageView *)giftImageView {
if (!_giftImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_giftImageView = [[NetImageView alloc] initWithConfig:config];
_giftImageView.contentMode = UIViewContentModeScaleAspectFill;
_giftImageView.layer.masksToBounds = YES;
_giftImageView.layer.borderWidth = 0.5;
_giftImageView.layer.borderColor = [ThemeColor colorWithHexString:@"#FFE974"].CGColor;
_giftImageView.layer.cornerRadius = 6;
}
return _giftImageView;
}
- (UILabel *)giftLabel {
if (!_giftLabel) {
_giftLabel = [[UILabel alloc] init];
_giftLabel.font = [UIFont systemFontOfSize:13];
_giftLabel.textColor = [UIColor whiteColor];
}
return _giftLabel;
}
- (UILabel *)timeLabel {
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.font = [UIFont systemFontOfSize:10];
_timeLabel.textColor = [ThemeColor colorWithHexString:@"#DCC3FF"];
}
return _timeLabel;
}
@end

View File

@@ -0,0 +1,17 @@
//
// XPCandyTreeRuleTableViewCell.h
// xplan-ios
//
// Created by 冯硕 on 2023/2/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class CandyTreeGiftModel;
@interface XPCandyTreeRuleTableViewCell : UITableViewCell
///奖励
@property (nonatomic,strong) CandyTreeGiftModel *prizeInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,142 @@
//
// XPCandyTreeRuleTableViewCell.m
// xplan-ios
//
// Created by on 2023/2/3.
//
#import "XPCandyTreeRuleTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "NetImageView.h"
///Model
#import "CandyTreeGiftModel.h"
@interface XPCandyTreeRuleTableViewCell ()
///
@property (nonatomic,strong) NetImageView *giftImageView;
///
@property (nonatomic,strong) UILabel *giftLabel;
///
@property (nonatomic,strong) UILabel *priceLabel;
///
@property (nonatomic,strong) UIImageView *diamondImageView;
///
@property (nonatomic,strong) UILabel *rateLabel;
@end
@implementation XPCandyTreeRuleTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.giftImageView];
[self.contentView addSubview:self.giftLabel];
[self.contentView addSubview:self.priceLabel];
[self.contentView addSubview:self.diamondImageView];
[self.contentView addSubview:self.rateLabel];
}
- (void)initSubViewConstraints {
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.width.height.mas_equalTo(44);
make.left.mas_equalTo(self.contentView).offset(15);
}];
[self.giftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.giftImageView.mas_right).offset(4);
make.bottom.mas_equalTo(self.giftImageView.mas_centerY).offset(-1.5);
make.right.mas_lessThanOrEqualTo(self.rateLabel.mas_left).offset(-5);
}];
[self.rateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.contentView).offset(-15);
make.centerY.mas_equalTo(self.contentView);
}];
[self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.giftImageView.mas_centerY).offset(1.5);
make.left.mas_equalTo(self.giftLabel);
}];
[self.diamondImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(9, 9));
make.centerY.mas_equalTo(self.priceLabel);
make.left.mas_equalTo(self.priceLabel.mas_right).offset(2);
}];
}
#pragma mark - Getters And Setters
- (void)setPrizeInfo:(CandyTreeGiftModel *)prizeInfo {
_prizeInfo = prizeInfo;
if (_prizeInfo) {
self.giftImageView.imageUrl = _prizeInfo.prizeUrl;
self.giftLabel.text = _prizeInfo.prizeName;
self.priceLabel.text = _prizeInfo.platformValue;
self.rateLabel.text = [NSString stringWithFormat:@"%0.2f%@", prizeInfo.showRate, @"%"];
}
}
- (NetImageView *)giftImageView {
if (!_giftImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_giftImageView = [[NetImageView alloc] initWithConfig:config];
_giftImageView.contentMode = UIViewContentModeScaleAspectFill;
_giftImageView.layer.masksToBounds = YES;
_giftImageView.layer.borderWidth = 0.5;
_giftImageView.layer.borderColor = [ThemeColor colorWithHexString:@"#FFE974"].CGColor;
_giftImageView.layer.cornerRadius = 6;
}
return _giftImageView;
}
- (UILabel *)giftLabel {
if (!_giftLabel) {
_giftLabel = [[UILabel alloc] init];
_giftLabel.font = [UIFont systemFontOfSize:13];
_giftLabel.textColor = [UIColor whiteColor];
}
return _giftLabel;
}
- (UILabel *)priceLabel {
if (!_priceLabel) {
_priceLabel = [[UILabel alloc] init];
_priceLabel.font = [UIFont systemFontOfSize:9];
_priceLabel.textColor = [ThemeColor colorWithHexString:@"#DCC3FF"];
}
return _priceLabel;
}
- (UILabel *)rateLabel {
if (!_rateLabel) {
_rateLabel = [[UILabel alloc] init];
_rateLabel.font = [UIFont systemFontOfSize:13];
_rateLabel.textColor = [UIColor whiteColor];
}
return _rateLabel;
}
- (UIImageView *)diamondImageView {
if (!_diamondImageView) {
_diamondImageView = [[UIImageView alloc] init];
_diamondImageView.userInteractionEnabled = YES;
_diamondImageView.image = [UIImage imageNamed:@"common_diamond"];
}
return _diamondImageView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPCandyTreeRuleHeaderView.h
// xplan-ios
//
// Created by 冯硕 on 2023/2/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPCandyTreeRuleHeaderView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,147 @@
//
// XPCandyTreeRuleHeaderView.m
// xplan-ios
//
// Created by on 2023/2/3.
//
#import "XPCandyTreeRuleHeaderView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "UIImage+Utils.h"
@interface XPCandyTreeRuleHeaderView ()
///
@property (nonatomic,strong) UIImageView *firstImageView;
///
@property (nonatomic,strong) UILabel *firstLabel;
///
@property (nonatomic,strong) UIImageView *secondImageView;
///100%
@property (nonatomic,strong) UILabel *secondLabel;
///
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic,strong) UIImageView *lineImageView;
@end
@implementation XPCandyTreeRuleHeaderView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.firstImageView];
[self addSubview:self.firstLabel];
[self addSubview:self.secondLabel];
[self addSubview:self.secondImageView];
[self addSubview:self.lineImageView];
[self addSubview:self.titleLabel];
}
- (void)initSubViewConstraints {
self.frame = CGRectMake(0, 0, 250, 74);
[self.firstImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self).offset(8);
make.size.mas_equalTo(CGSizeMake(8, 8));
make.top.mas_equalTo(self);
}];
[self.firstLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.firstImageView.mas_right).offset(6);
make.right.mas_equalTo(self).offset(-8);
make.top.mas_equalTo(self.firstImageView);
}];
[self.secondImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.firstImageView);
make.size.mas_equalTo(self.firstImageView);
make.top.mas_equalTo(self.firstImageView.mas_bottom).offset(25);
}];
[self.secondLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.firstLabel);
make.top.mas_equalTo(self.secondImageView);
}];
[self.lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(54, 4));
make.centerY.mas_equalTo(self.titleLabel.mas_bottom).offset(-1);
make.centerX.mas_equalTo(self.titleLabel);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self).offset(25);
make.top.mas_equalTo(self.secondImageView.mas_bottom).offset(13);
}];
}
#pragma mark - Getters And Setters
- (UIImageView *)firstImageView {
if (!_firstImageView) {
_firstImageView = [[UIImageView alloc] init];
_firstImageView.userInteractionEnabled = YES;
_firstImageView.image = [UIImage imageNamed:@"candy_tree_rule_star"];
}
return _firstImageView;
}
- (UIImageView *)lineImageView {
if (!_lineImageView) {
_lineImageView = [[UIImageView alloc] init];
_lineImageView.image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#E7991A"], [ThemeColor colorWithHexString:@"#FFE2BB"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(54, 4)];
_lineImageView.layer.masksToBounds = YES;
_lineImageView.layer.cornerRadius = 2;
}
return _lineImageView;
}
- (UILabel *)firstLabel {
if (!_firstLabel) {
_firstLabel = [[UILabel alloc] init];
_firstLabel.font = [UIFont systemFontOfSize:10];
_firstLabel.textColor = [ThemeColor colorWithHexString:@"#F8CBFF"];
_firstLabel.text = @"通过许愿池许愿获得的礼物放到礼物包裹,点开礼物面板即可查看;";
_firstLabel.numberOfLines = 2;
}
return _firstLabel;
}
- (UIImageView *)secondImageView {
if (!_secondImageView) {
_secondImageView = [[UIImageView alloc] init];
_secondImageView.userInteractionEnabled = YES;
_secondImageView.image = [UIImage imageNamed:@"candy_tree_rule_star"];
}
return _secondImageView;
}
- (UILabel *)secondLabel {
if (!_secondLabel) {
_secondLabel = [[UILabel alloc] init];
_secondLabel.font = [UIFont systemFontOfSize:10];
_secondLabel.textColor = [ThemeColor colorWithHexString:@"#F8CBFF"];
_secondLabel.text = @"每次许愿100%获得礼物。";
}
return _secondLabel;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.text = @"礼物概率:";
}
return _titleLabel;
}
@end

View File

@@ -13,6 +13,7 @@
///Tool
#import "ThemeColor+Room.h"
#import "XPMacro.h"
#import "UIImage+Utils.h"
///View
#import "XPCandyTreeRankView.h"
@interface XPCandyRankContainerView ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate>
@@ -22,12 +23,14 @@
@property (nonatomic, strong) JXCategoryTitleView *titleView;
///lineView
@property (nonatomic, strong) JXCategoryListContainerView *contentView;
///
@property (nonatomic,strong) UIButton *refreshButton;
///
@property (nonatomic,strong) XPCandyTreeRankView *todayListView;
///
@property (nonatomic,strong) XPCandyTreeRankView *yesterdayListView;
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UIImageView *backView;
@end
@implementation XPCandyRankContainerView
@@ -43,38 +46,39 @@
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor whiteColor];
[self addSubview:self.titleView];
[self addSubview:self.self.refreshButton];
[self addSubview:self.contentView];
CAShapeLayer * layer = [CAShapeLayer layer];
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 400) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)];
layer.path = path.CGPath;
self.layer.mask = layer;
self.backgroundColor = [UIColor clearColor];
[self addSubview:self.backImageView];
[self.backImageView addSubview:self.backView];
[self.backView addSubview:self.titleView];
[self.backView addSubview:self.contentView];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(50+ 350);
self.frame = CGRectMake(0, 0, 271, 403);
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(250, 340));
make.centerX.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.backImageView).offset(52);
}];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self);
make.height.mas_equalTo(50);
make.width.mas_equalTo(180);
make.centerX.mas_equalTo(self.backView);
make.top.mas_equalTo(self.backView).offset(10);
make.height.mas_equalTo(28);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self);
make.top.mas_equalTo(self.titleView.mas_bottom);
}];
[self.refreshButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-15);
make.centerY.mas_equalTo(self.titleView.mas_centerY);
make.width.height.mas_equalTo(50);
make.left.right.bottom.mas_equalTo(self.backView);
make.top.mas_equalTo(self.titleView.mas_bottom).offset(5);
}];
}
#pragma mark - JXCategoryViewDelegate
@@ -96,30 +100,57 @@
}
#pragma mark - Getters And Setters
- (UIImageView *)backView {
if (!_backView) {
_backView = [[UIImageView alloc] init];
_backView.userInteractionEnabled = YES;
_backView.image = [UIImage imageNamed:@"room_candy_tree_content_back"];
}
return _backView;
}
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"room_candy_tree_back"];
}
return _backImageView;
}
- (JXCategoryTitleView *)titleView {
if (!_titleView) {
_titleView = [[JXCategoryTitleView alloc] init];
_titleView.delegate = self;
_titleView.titles = self.titles;
_titleView.titleColor = [ThemeColor textThirdColor];
_titleView.titleSelectedColor = [ThemeColor candyTreeNickColor];
_titleView.titleFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
_titleView.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
_titleView.titleSelectedColor = [ThemeColor colorWithHexString:@"#0D002F"];
_titleView.titleColor = [UIColor whiteColor];
_titleView.titleFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
_titleView.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
_titleView.defaultSelectedIndex = 0;
_titleView.listContainer = self.contentView;
_titleView.backgroundColor = [ThemeColor colorWithHexString:@"#0D002F"];
_titleView.layer.masksToBounds = YES;
_titleView.layer.cornerRadius = 27 / 2;
_titleView.layer.borderWidth = 0.5;
_titleView.layer.borderColor = [ThemeColor colorWithHexString:@"#FFE974"].CGColor;
_titleView.cellWidth = 88;
_titleView.cellSpacing = 0;
JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
lineView.indicatorColor = [ThemeColor appMainColor];
lineView.indicatorWidth = 8.f;
lineView.indicatorHeight = 4.f;
lineView.indicatorCornerRadius = 2.f;
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
lineView.indicatorImageView.image = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFE2BB"], [ThemeColor colorWithHexString:@"#E7991A"]] gradientType:GradientTypeTopToBottom imgSize:CGSizeMake(88, 24)];
lineView.indicatorImageViewSize = CGSizeMake(88, 24);
lineView.layer.masksToBounds = YES;
lineView.layer.cornerRadius = 12;
lineView.verticalMargin = 2;
_titleView.indicators = @[lineView];
}
return _titleView;
}
- (JXCategoryListContainerView *)contentView {
if (!_contentView) {
_contentView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
@@ -132,16 +163,6 @@
return @[@"今日榜单", @"昨日榜单"];
}
- (UIButton *)refreshButton {
if (!_refreshButton) {
_refreshButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_refreshButton setImage:[UIImage imageNamed:@"room_candy_tree_record_refresh"] forState:UIControlStateNormal];
[_refreshButton setImage:[UIImage imageNamed:@"room_candy_tree_record_refresh"] forState:UIControlStateSelected];
[_refreshButton addTarget:self action:@selector(refreshButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _refreshButton;
}
- (XPCandyTreeRankView *)todayListView {
if (!_todayListView) {
_todayListView = [[XPCandyTreeRankView alloc] init];

View File

@@ -11,6 +11,7 @@
#import <Masonry/Masonry.h>
#import "CandyTreeResultModel.h"
#import "XPCandyTreeAnimationModel.h"
#import "ThemeColor.h"
@interface XPCandyTreeGiftView ()
///
@@ -33,18 +34,20 @@
}
#pragma mark - Private Method
- (void)initSubViews {
self.layer.masksToBounds = YES;
[self addSubview:self.backImageView];
[self addSubview:self.titleLabel];
}
- (void)initSubViewConstraints {
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self);
make.height.mas_equalTo(19);
make.right.top.mas_equalTo(self);
make.left.mas_equalTo(self).offset(-8);
make.height.mas_equalTo(22);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backImageView.mas_left).offset(3);
make.left.mas_equalTo(self.backImageView.mas_left).offset(11);
make.centerY.mas_equalTo(self.backImageView);
}];
}
@@ -52,13 +55,16 @@
- (void)setGiftInfo:(CandyTreeGiftInfoModel *)giftInfo {
_giftInfo = giftInfo;
if (_giftInfo) {
NSString * backImage= @"candy_tree_levle_third";
if(giftInfo.prizeLevel == CandyTreeGiftLevel_Fourth) {
backImage = @"candy_tree_levle_fourth";
self.backImageView.backgroundColor = [ThemeColor colorWithHexString:@"#3400BC"];
self.backImageView.layer.borderColor = [ThemeColor colorWithHexString:@"#FFFDFB"].CGColor;
} else if(giftInfo.prizeLevel == CandyTreeGiftLevel_Fifth) {
backImage = @"candy_tree_levle_fifth";
self.backImageView.backgroundColor = [ThemeColor colorWithHexString:@"#C65900"];
self.backImageView.layer.borderColor = [ThemeColor colorWithHexString:@"#FFFA65"].CGColor;
} else {
self.backImageView.backgroundColor = [ThemeColor colorWithHexString:@"#0D002F"];
self.backImageView.layer.borderColor = [ThemeColor colorWithHexString:@"#ACAAFF"].CGColor;
}
self.backImageView.image = [UIImage imageNamed:backImage];
if (_giftInfo.prizeName.length > 7) {
_giftInfo.prizeName = [_giftInfo.prizeName substringToIndex:7];
}
@@ -72,6 +78,9 @@
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.layer.masksToBounds = YES;
_backImageView.layer.cornerRadius = 11;
_backImageView.layer.borderWidth = 0.5;
}
return _backImageView;
}

View File

@@ -15,20 +15,27 @@
#import "TTPopup.h"
#import "XCHUDTool.h"
#import "NSArray+Safe.h"
///Model
#import "CandyTreeMoreItemModel.h"
///View
#import "XPRoomHalfWebView.h"
#import "XPCandyTreeMoreRuleCell.h"
#import "XPCandyTreeRecordView.h"
#import "XPCandyTreeRuleView.h"
///
NSString * const kCandyTreeHideMessage = @"kCandyTreeHideMessage";
@interface XPCandyTreeMoreView ()<UITableViewDelegate, UITableViewDataSource, XPCandyTreeMoreRuleCellDelegate>
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UIImageView *contentView;
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSMutableArray *datasource;
@property (nonatomic,strong) NSArray *datasource;
@end
@implementation XPCandyTreeMoreView
@@ -45,35 +52,42 @@ NSString * const kCandyTreeHideMessage = @"kCandyTreeHideMessage";
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor whiteColor];
[self addSubview:self.titleLabel];
[self addSubview:self.tableView];
CAShapeLayer * layer = [CAShapeLayer layer];
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 256+44) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)];
layer.path = path.CGPath;
self.layer.mask = layer;
self.backgroundColor = [UIColor clearColor];
[self addSubview:self.backImageView];
[self.backImageView addSubview:self.contentView];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.tableView];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(256+44);
self.frame = CGRectMake(0, 0, 271, 403);
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(250, 340));
make.centerX.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.backImageView).offset(52);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self);
make.height.mas_equalTo(44);
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.contentView).offset(14);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self);
make.top.mas_equalTo(self.titleLabel.mas_bottom);
make.left.right.bottom.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
}];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 50;
return 39;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
@@ -81,79 +95,93 @@ NSString * const kCandyTreeHideMessage = @"kCandyTreeHideMessage";
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row != 3) {
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class])];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([UITableViewCell class])];
}
cell.backgroundColor = [UIColor whiteColor];
cell.textLabel.text = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.textLabel.textColor = [ThemeColor alertTitleColor];
cell.textLabel.font = [UIFont systemFontOfSize:15];
return cell;
}
XPCandyTreeMoreRuleCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPCandyTreeMoreRuleCell class])];
cell.title = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
NSString *showSwitch = [[NSUserDefaults standardUserDefaults] objectForKey:kCandyTreeHideMessage];
cell.isShow = !showSwitch.length;
cell.isSwitchEnable = self.showMessageSwitch;
XPCandyTreeMoreRuleCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPCandyTreeMoreRuleCell class])];
CandyTreeMoreItemModel * model = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.delegate = self;
if (model.type == CandyTreeMoreItemType_Switch) {
NSString *showSwitch = [[NSUserDefaults standardUserDefaults] objectForKey:kCandyTreeHideMessage];
model.switchState = !showSwitch.length;
model.switchEnable = self.showMessageSwitch;
}
cell.itemModel = model;
cell.sendMessageSwitchLevel = self.sendMessageSwitchLevel;
return cell;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[TTPopup dismiss];
switch (indexPath.row) {
case 0:
{
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = URLWithType(kCandyTreeURL);
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
if (self.datasource.count > 0) {
CandyTreeMoreItemModel * model = [self.datasource safeObjectAtIndex1:indexPath.row];
switch (model.type) {
case CandyTreeMoreItemType_Buy:
{
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = URLWithType(kCandyTreeURL);
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
}
break;
case CandyTreeMoreItemType_Record:
{
XPCandyTreeRecordView * webView = [[XPCandyTreeRecordView alloc] init];
[TTPopup popupView:webView style:TTPopupStyleAlert];
}
break;
case CandyTreeMoreItemType_Rule:
{
XPCandyTreeRuleView * webView = [[XPCandyTreeRuleView alloc] init];
[TTPopup popupView:webView style:TTPopupStyleAlert];
}
break;
default:
break;
}
break;
case 1:
{
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = URLWithType(kCandyTreeRecordURL);
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
}
break;
case 2:
{
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
webView.url = URLWithType(kCandyTreeRuleURL);
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
}
break;
default:
break;
}
}
#pragma mark - XPCandyTreeMoreRuleCellDelegate
- (void)xPCandyTreeMoreRuleCell:(XPCandyTreeMoreRuleCell *)cell switchChange:(UISwitch *)change {
if (change.on) {
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:kCandyTreeHideMessage];
} else {
[[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:kCandyTreeHideMessage];
}
[[NSUserDefaults standardUserDefaults] synchronize];
if (change.on) {
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:kCandyTreeHideMessage];
} else {
[[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:kCandyTreeHideMessage];
}
[[NSUserDefaults standardUserDefaults] synchronize];
}
#pragma mark - Getters And Setters
- (UIImageView *)contentView {
if (!_contentView) {
_contentView = [[UIImageView alloc] init];
_contentView.userInteractionEnabled = YES;
_contentView.image = [UIImage imageNamed:@"room_candy_tree_content_back"];
}
return _contentView;
}
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"room_candy_tree_back"];
}
return _backImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"更多";
_titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [ThemeColor alertTitleColor];
_titleLabel.text = @"更多";
}
return _titleLabel;
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
@@ -166,14 +194,33 @@ NSString * const kCandyTreeHideMessage = @"kCandyTreeHideMessage";
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableViewCell class])];
[_tableView registerClass:[XPCandyTreeMoreRuleCell class] forCellReuseIdentifier:NSStringFromClass([XPCandyTreeMoreRuleCell class])];
[_tableView registerClass:[XPCandyTreeMoreRuleCell class] forCellReuseIdentifier:NSStringFromClass([XPCandyTreeMoreRuleCell class])];
}
return _tableView;
}
- (NSMutableArray *)datasource {
- (NSArray *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray arrayWithObjects:@"参与活动获得糖果", @"获奖记录", @"玩法规则",@"允许将中奖消息对外展示" ,nil];
///
CandyTreeMoreItemModel * buyModel = [[CandyTreeMoreItemModel alloc] init];
buyModel.title = @"参与活动获得糖果";
buyModel.type = CandyTreeMoreItemType_Buy;
///
CandyTreeMoreItemModel * recordModel = [[CandyTreeMoreItemModel alloc] init];
recordModel.title = @"获奖记录";
recordModel.type = CandyTreeMoreItemType_Record;
///
CandyTreeMoreItemModel * ruleModel = [[CandyTreeMoreItemModel alloc] init];
ruleModel.title = @"玩法规则";
ruleModel.type = CandyTreeMoreItemType_Rule;
///
CandyTreeMoreItemModel * switchModel = [[CandyTreeMoreItemModel alloc] init];
switchModel.title = @"允许将中奖消息对外展示";
switchModel.type = CandyTreeMoreItemType_Switch;
_datasource = @[buyModel, recordModel, ruleModel, switchModel];
}
return _datasource;
}

View File

@@ -14,6 +14,7 @@
#import "XCHudTool.h"
#import "Api+CandyTree.h"
#import "NSArray+Safe.h"
#import "XPMacro.h"
///Model
#import "CandyTreeRecordModel.h"
///View
@@ -129,7 +130,7 @@
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.datasource.count > 0 ? 75 : 300;
return self.datasource.count > 0 ? 56 : (340 - 52 - 30);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

View File

@@ -0,0 +1,16 @@
//
// XPCandyTreeRuleView.h
// xplan-ios
//
// Created by 冯硕 on 2023/2/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPCandyTreeRecordView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,224 @@
//
// XPCandyTreeRuleView.m
// xplan-ios
//
// Created by on 2023/2/3.
//
#import "XPCandyTreeRecordView.h"
///Third
#import <MJRefresh/MJRefresh.h>
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
#import "NSArray+Safe.h"
#import "Api+CandyTree.h"
#import "XCHUDTool.h"
#import "AccountInfoStorage.h"
///Model
#import "CandyTreeGiftModel.h"
///View
#import "XPCandyTreeEmptyableViewCell.h"
#import "XPCandyTreeRecordTableViewCell.h"
@interface XPCandyTreeRecordView ()<UITableViewDelegate, UITableViewDataSource>
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UIImageView *contentView;
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSMutableArray *datasource;
///
@property (nonatomic,assign) int page;
@end
@implementation XPCandyTreeRecordView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initHeaderAndFooterRrfresh];
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Refresh
- (void)initHeaderAndFooterRrfresh {
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
header.stateLabel.textColor = [ThemeColor secondTextColor];
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
self.tableView.mj_header = header;
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
footer.stateLabel.textColor = [ThemeColor secondTextColor];
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
self.tableView.mj_footer = footer;
[self headerRefresh];
}
- (void)headerRefresh {
self.page = 1;
NSString * page = [NSString stringWithFormat:@"%d", self.page];
NSString * uid = [[AccountInfoStorage instance] getUid];
[Api candyTreeDrawrecord:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
[self.tableView.mj_header endRefreshing];
if (code == 200) {
[self.datasource removeAllObjects];
NSArray * array = [CandyTreeGiftModel modelsWithArray:data.data];
[self.datasource addObjectsFromArray:array];
[self.tableView reloadData];
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} page:page pageSize:@"20" uid:uid sortType:@"time"];
}
- (void)footerRefresh {
self.page++;
NSString * page = [NSString stringWithFormat:@"%d", self.page];
NSString * uid = [[AccountInfoStorage instance] getUid];
[Api candyTreeDrawrecord:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
[self.tableView.mj_footer endRefreshing];
if (code == 200) {
NSArray * array = [CandyTreeGiftModel modelsWithArray:data.data];
if (array.count > 0) {
[self.datasource addObjectsFromArray:array];
}
[self.tableView reloadData];
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} page:page pageSize:@"20" uid:uid sortType:@"time"];
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
[self addSubview:self.backImageView];
[self.backImageView addSubview:self.contentView];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.tableView];
}
- (void)initSubViewConstraints {
self.frame = CGRectMake(0, 0, 271, 403);
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(250, 340));
make.centerX.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.backImageView).offset(52);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.contentView).offset(12);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
}];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count > 0 ? self.datasource.count : 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.datasource.count > 0 ? 56 : (340 - 52);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPCandyTreeRecordTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPCandyTreeRecordTableViewCell class])];
if (cell == nil) {
cell = [[XPCandyTreeRecordTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPCandyTreeRecordTableViewCell class])];
}
CandyTreeGiftModel * giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.prizeInfo = giftInfo;
return cell;
}
XPCandyTreeEmptyableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPCandyTreeEmptyableViewCell class])];
if (cell == nil) {
cell = [[XPCandyTreeEmptyableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPCandyTreeEmptyableViewCell class])];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
#pragma mark - Getters And Setters
- (UIImageView *)contentView {
if (!_contentView) {
_contentView = [[UIImageView alloc] init];
_contentView.userInteractionEnabled = YES;
_contentView.image = [UIImage imageNamed:@"room_candy_tree_content_back"];
}
return _contentView;
}
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"room_candy_tree_back"];
}
return _backImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.text = @"获奖记录";
}
return _titleLabel;
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPCandyTreeEmptyableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPCandyTreeEmptyableViewCell class])];
[_tableView registerClass:[XPCandyTreeRecordTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPCandyTreeRecordTableViewCell class])];
}
return _tableView;
}
- (NSMutableArray *)datasource {
if (!_datasource) {
_datasource = [NSMutableArray array];
}
return _datasource;
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPCandyTreeRuleView.h
// xplan-ios
//
// Created by 冯硕 on 2023/2/3.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPCandyTreeRuleView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,196 @@
//
// XPCandyTreeRuleView.m
// xplan-ios
//
// Created by on 2023/2/3.
//
#import "XPCandyTreeRuleView.h"
///Third
#import <MJRefresh/MJRefresh.h>
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
#import "NSArray+Safe.h"
#import "Api+CandyTree.h"
#import "XCHUDTool.h"
#import "AccountInfoStorage.h"
///Model
#import "CandyTreeGiftModel.h"
///View
#import "XPCandyTreeRuleHeaderView.h"
#import "XPCandyTreeEmptyableViewCell.h"
#import "XPCandyTreeRuleTableViewCell.h"
@interface XPCandyTreeRuleView ()<UITableViewDelegate, UITableViewDataSource>
///view
@property (nonatomic,strong) XPCandyTreeRuleHeaderView *headerView;
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UIImageView *contentView;
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSArray *datasource;
///
@property (nonatomic,assign) int page;
@end
@implementation XPCandyTreeRuleView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self requestPrizeList];
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Http
- (void)requestPrizeList {
[Api candyTreeOpenRule:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSArray * array = [CandyTreeGiftModel modelsWithArray:data.data];
self.datasource = array;
[self.tableView reloadData];
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} boxType:@"2"];
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
[self addSubview:self.backImageView];
[self.backImageView addSubview:self.contentView];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.tableView];
self.tableView.tableHeaderView = self.headerView;
}
- (void)initSubViewConstraints {
self.frame = CGRectMake(0, 0, 271, 403);
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(250, 340));
make.centerX.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.backImageView).offset(52);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.contentView).offset(14);
}];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
}];
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count > 0 ? self.datasource.count : 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.datasource.count > 0 ? 56 : (340 - 52 - 74);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
XPCandyTreeRuleTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPCandyTreeRuleTableViewCell class])];
if (cell == nil) {
cell = [[XPCandyTreeRuleTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPCandyTreeRuleTableViewCell class])];
}
CandyTreeGiftModel * giftInfo = [self.datasource safeObjectAtIndex1:indexPath.row];
cell.prizeInfo = giftInfo;
return cell;
}
XPCandyTreeEmptyableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPCandyTreeEmptyableViewCell class])];
if (cell == nil) {
cell = [[XPCandyTreeEmptyableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPCandyTreeEmptyableViewCell class])];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
#pragma mark - Getters And Setters
- (UIImageView *)contentView {
if (!_contentView) {
_contentView = [[UIImageView alloc] init];
_contentView.userInteractionEnabled = YES;
_contentView.image = [UIImage imageNamed:@"room_candy_tree_content_back"];
}
return _contentView;
}
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"room_candy_tree_back"];
}
return _backImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.text = @"玩法规则";
}
return _titleLabel;
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.showsVerticalScrollIndicator = NO;
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPCandyTreeEmptyableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPCandyTreeEmptyableViewCell class])];
[_tableView registerClass:[XPCandyTreeRuleTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPCandyTreeRuleTableViewCell class])];
}
return _tableView;
}
- (NSArray *)datasource {
if (!_datasource) {
_datasource = [NSArray array];
}
return _datasource;
}
- (XPCandyTreeRuleHeaderView *)headerView {
if (!_headerView) {
_headerView = [[XPCandyTreeRuleHeaderView alloc] init];
}
return _headerView;
}
@end

View File

@@ -10,12 +10,15 @@
#import <Masonry/Masonry.h>
#import <SVGA.h>
#import <NIMSDK/NIMSDK.h>
#import "QGVAPConfigModel.h"
#import "UIView+VAP.h"
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
#import "TTPopup.h"
#import "NSArray+Safe.h"
#import "XPHtmlUrl.h"
#import "XPRoomGiftAnimationParser.h"
///Model
#import "RoomInfoModel.h"
#import "AttachmentModel.h"
@@ -30,24 +33,18 @@
///P
#import "XPCandyTreePresenter.h"
#import "XPCandyTreeProtocol.h"
#define KitemHeight (20 + 5)
@interface XPCandyTreeViewController ()<XPCandyTreeProtocol, NIMSystemNotificationManagerDelegate>
#define KitemHeight (22 + 5)
@interface XPCandyTreeViewController ()<XPCandyTreeProtocol, NIMSystemNotificationManagerDelegate, HWDMP4PlayDelegate>
///view
@property (nonatomic,strong) UIView *topTapView;
///view
@property (nonatomic,strong) UIView *bottomTapView;
///
@property (nonatomic,strong) UIView * contentView;
///
@property (nonatomic,strong) UIImageView *topLogoImageView;
///
@property (nonatomic,strong) UIImageView * backView;
///
@property (nonatomic,strong) UIStackView *rankStackView;
///
@property (nonatomic,strong) UIImageView * rankImageView;
///
@property (nonatomic,strong) UILabel *rankLabel;
///
@property (nonatomic,strong) UIImageView *moreImageView;
///
@@ -58,8 +55,10 @@
@property (nonatomic,strong) UILabel *countLabel;
///
@property (strong, nonatomic) SVGAParser *parser;
///
@property (nonatomic,strong) SVGAImageView *candyTreeView;
///VAP
@property (nonatomic, strong) VAPView *candyTreeView;
///VAP
@property (nonatomic, strong) XPRoomGiftAnimationParser *vapParser;
///
@property (nonatomic,strong) SVGAImageView *candyTreeLightView;
///
@@ -145,7 +144,7 @@
XPCandyTreeGiftView * newAnimaView = [[XPCandyTreeGiftView alloc] init];
newAnimaView.giftInfo = obj;
NSString * giftTitle = [NSString stringWithFormat:@"%@ x %d", obj.prizeName, obj.prizeNum];
CGFloat widht = [giftTitle boundingRectWithSize:CGSizeMake(200, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10]} context:nil].size.width + 10;
CGFloat widht = [giftTitle boundingRectWithSize:CGSizeMake(200, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10]} context:nil].size.width + 14;
newAnimaView.frame = CGRectMake(0, 4 * (KitemHeight), widht, KitemHeight);
[self.animationView addSubview:newAnimaView];
@@ -195,6 +194,21 @@
}
}
}
#pragma mark - HWDMP4PlayDelegate
//truefalse
- (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config {
return YES;
}
- (void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container {
}
- (void)viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container {
}
#pragma mark - Private Method
- (void)initSubViews {
self.view.backgroundColor = [UIColor clearColor];
@@ -203,12 +217,11 @@
[self.view addSubview:self.bottomTapView];
[self.contentView addSubview:self.backView];
[self.contentView addSubview:self.topLogoImageView];
[self.backView addSubview:self.rankStackView];
[self.backView addSubview:self.candyTreeView];
[self.backView addSubview:self.rankImageView];
[self.backView addSubview:self.moreImageView];
[self.backView addSubview:self.countStackView];
[self.backView addSubview:self.candyTreeView];
[self.backView addSubview:self.candyTreeLightView];
[self.backView addSubview:self.candyTreeOpenView];
[self.backView addSubview:self.expendLabel];
@@ -217,24 +230,18 @@
[self.backView addSubview:self.pickButton];
[self.backView addSubview:self.candyTreeTransView];
[self.backView addSubview:self.animationView];
[self.rankStackView addArrangedSubview:self.rankImageView];
[self.rankStackView addArrangedSubview:self.rankLabel];
[self.countStackView addArrangedSubview:self.countImageView];
[self.countStackView addArrangedSubview:self.countLabel];
[self.pickStackView addArrangedSubview:self.subtractButton];
[self.pickStackView addArrangedSubview:self.textFiled];
[self.pickStackView addArrangedSubview:self.addButton];
@kWeakify(self);
[self.parser parseWithNamed:@"candyTree" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.candyTreeView.loops = INT_MAX;
self.candyTreeView.clearsAfterStop = NO;
self.candyTreeView.videoItem = videoItem;
[self.candyTreeView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"candy_tree" ofType:@"mp4"];
[self.candyTreeView setMute:YES];
[self.candyTreeView playHWDMP4:filePath repeatCount:INTMAX_MAX delegate:self];
});
}
- (void)initSubViewConstraints {
@@ -254,42 +261,36 @@
make.top.mas_equalTo(self.contentView.mas_bottom);
make.bottom.mas_equalTo(self.view);
}];
[self.topLogoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(190);
make.height.mas_equalTo(54);
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.contentView);
}];
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(285);
make.height.mas_equalTo(416);
make.width.mas_equalTo(271);
make.height.mas_equalTo(403);
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.contentView).offset(27);
make.top.mas_equalTo(self.contentView).offset(0);
}];
[self.rankStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.backView).offset(35);
make.left.mas_equalTo(self.backView).offset(15);
make.height.mas_equalTo(20);
}];
[self.moreImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(32, 21));
make.centerY.mas_equalTo(self.rankStackView);
make.size.mas_equalTo(CGSizeMake(30, 30));
make.top.mas_equalTo(self.backView).offset(46);
make.right.mas_equalTo(self.backView).offset(-15);
}];
[self.rankImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(30, 30));
make.top.mas_equalTo(self.moreImageView.mas_bottom).offset(11);
make.right.mas_equalTo(self.backView).offset(-15);
}];
[self.countStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.moreImageView.mas_bottom).offset(12);
make.centerX.mas_equalTo(self.moreImageView);
make.top.mas_equalTo(self.backView).offset(46);
make.left.mas_equalTo(self.backView).offset(15);
}];
[self.candyTreeView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.backView).offset(52);
make.top.mas_equalTo(self.backView).offset(22);
make.centerX.mas_equalTo(self.backView);
make.size.mas_equalTo(CGSizeMake(190, 242));
make.size.mas_equalTo(CGSizeMake(270, 379));
}];
[self.candyTreeLightView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -302,11 +303,11 @@
[self.expendLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backView);
make.bottom.mas_equalTo(self.self.pickBackImageView.mas_top).offset(-3);
make.bottom.mas_equalTo(self.backView.mas_bottom).offset(-17);
}];
[self.pickBackImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(111, 25));
make.size.mas_equalTo(CGSizeMake(111, 28));
make.centerX.mas_equalTo(self.backView);
make.bottom.mas_equalTo(self.pickButton.mas_top).offset(-15);
}];
@@ -318,7 +319,7 @@
[self.pickButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(135, 39));
make.centerX.mas_equalTo(self.backView);
make.bottom.mas_equalTo(self.backView).offset(-21);
make.bottom.mas_equalTo(self.backView).offset(-35);
}];
CGFloat kscale = (CGFloat)350 / (CGFloat)755;
@@ -345,25 +346,25 @@
XPCandyTreeMoreView * moreView = [[XPCandyTreeMoreView alloc] init];
moreView.sendMessageSwitchLevel = self.candyInfo.sendMessageSwitchLevel;
moreView.showMessageSwitch = self.hostDelegate.getUserInfo.userLevelVo.experLevelSeq >= self.candyInfo.sendMessageSwitchLevel;
[TTPopup popupView:moreView style:TTPopupStyleActionSheet];
[TTPopup popupView:moreView style:TTPopupStyleAlert];
}
- (void)rankTapRecognizer:(UITapGestureRecognizer *)tap {
XPCandyRankContainerView * rankView = [[XPCandyRankContainerView alloc] init];
[TTPopup popupView:rankView style:TTPopupStyleActionSheet];
[TTPopup popupView:rankView style:TTPopupStyleAlert];
}
- (void)addButtonAction:(UIButton *)sender {
self.numberCandy += 1;
self.textFiled.text = [NSString stringWithFormat:@"%ld", self.numberCandy];
self.expendLabel.text = [NSString stringWithFormat:@"消耗%ld糖果连续", self.numberCandy];
self.expendLabel.text = [NSString stringWithFormat:@"消耗%ld根魔法棒可连续", self.numberCandy];
}
- (void)subtractButtonAction:(UIButton *)sender {
if (self.numberCandy <= 1) return;
self.numberCandy -= 1;
self.textFiled.text = [NSString stringWithFormat:@"%ld", self.numberCandy];
self.expendLabel.text = [NSString stringWithFormat:@"消耗%ld糖果连续", self.numberCandy];
self.expendLabel.text = [NSString stringWithFormat:@"消耗%ld根魔法棒可连续", self.numberCandy];
}
- (void)pickButtonAction:(UIButton *)sender {
@@ -374,7 +375,7 @@
if (self.numberCandy > self.candyInfo.keyNum) {
TTAlertConfig * config = [[TTAlertConfig alloc] init];
config.title = @"";
config.message = @"参与活动获得糖果";
config.message = @"参与活动获得魔法棒";
config.confirmButtonConfig.title = @"去参与";
[TTPopup alertWithConfig:config confirmHandler:^{
[TTPopup dismiss];
@@ -388,16 +389,6 @@
if (self.isPicking) return;
self.isPicking = YES;
@kWeakify(self);
[self.parser parseWithNamed:@"candyTree_light" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.candyTreeLightView.loops = 1;
self.candyTreeLightView.clearsAfterStop = YES;
self.candyTreeLightView.videoItem = videoItem;
[self.candyTreeLightView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
[self.parser parseWithNamed:@"candyTree_open" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.candyTreeOpenView.loops = 1;
@@ -421,10 +412,10 @@
- (void)textFieldDidChanged:(UITextField *)textField {
if (textField.text.integerValue > 200) {
textField.text = @"200";
[self showErrorToast:@"一次性最多只能200"];
[self showErrorToast:@"一次性最多只能消耗200根魔法棒"];
}
self.numberCandy = textField.text.intValue;
self.expendLabel.text = [NSString stringWithFormat:@"消耗%@糖果连续", textField.text];
self.expendLabel.text = [NSString stringWithFormat:@"消耗%@根魔法棒可连续", textField.text];
}
#pragma mark - Getters And Setters
@@ -460,15 +451,6 @@
return _contentView;
}
- (UIImageView *)topLogoImageView {
if (!_topLogoImageView) {
_topLogoImageView = [[UIImageView alloc] init];
_topLogoImageView.userInteractionEnabled = YES;
_topLogoImageView.image = [UIImage imageNamed:@"room_candy_tree_header"];
}
return _topLogoImageView;
}
- (UIImageView *)backView {
if (!_backView) {
_backView = [[UIImageView alloc] init];
@@ -478,37 +460,18 @@
return _backView;
}
- (UIStackView *)rankStackView {
if (!_rankStackView) {
_rankStackView = [[UIStackView alloc] init];
_rankStackView.axis = UILayoutConstraintAxisHorizontal;
_rankStackView.distribution = UIStackViewDistributionFill;
_rankStackView.alignment = UIStackViewAlignmentCenter;
_rankStackView.spacing = 5;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(rankTapRecognizer:)];
[_rankStackView addGestureRecognizer:tap];
}
return _rankStackView;
}
- (UIImageView *)rankImageView {
if (!_rankImageView) {
_rankImageView = [[UIImageView alloc] init];
_rankImageView.userInteractionEnabled = YES;
_rankImageView.image = [UIImage imageNamed:@"room_candy_tree_rank"];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(rankTapRecognizer:)];
[_rankImageView addGestureRecognizer:tap];
}
return _rankImageView;
}
- (UILabel *)rankLabel {
if (!_rankLabel) {
_rankLabel = [[UILabel alloc] init];
_rankLabel.text = @"排行榜";
_rankLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
_rankLabel.textColor = [UIColor whiteColor];
}
return _rankLabel;
}
- (UIImageView *)moreImageView {
if (!_moreImageView) {
@@ -524,10 +487,10 @@
- (UIStackView *)countStackView {
if (!_countStackView) {
_countStackView = [[UIStackView alloc] init];
_countStackView.axis = UILayoutConstraintAxisVertical;
_countStackView.axis = UILayoutConstraintAxisHorizontal;
_countStackView.distribution = UIStackViewDistributionFill;
_countStackView.alignment = UIStackViewAlignmentCenter;
_countStackView.spacing = 4;
_countStackView.spacing = 5;
}
return _countStackView;
}
@@ -550,15 +513,6 @@
return _countLabel;
}
- (SVGAImageView *)candyTreeView {
if (!_candyTreeView) {
_candyTreeView = [[SVGAImageView alloc]init];
_candyTreeView.backgroundColor = [UIColor clearColor];
_candyTreeView.userInteractionEnabled = NO;
}
return _candyTreeView;
}
- (SVGAImageView *)candyTreeLightView {
if (!_candyTreeLightView) {
_candyTreeLightView = [[SVGAImageView alloc]init];
@@ -607,7 +561,7 @@
if (!_pickBackImageView) {
_pickBackImageView = [[UIImageView alloc] init];
_pickBackImageView.userInteractionEnabled = YES;
_pickBackImageView.image = [UIImage imageNamed:@"room_candy_tree_pick_bg"];
_pickBackImageView.backgroundColor = [ThemeColor colorWithHexString:@"#0D002F"];
}
return _pickBackImageView;
}
@@ -678,5 +632,20 @@
return _animationView;
}
- (VAPView *)candyTreeView {
if (!_candyTreeView) {
_candyTreeView = [[VAPView alloc] initWithFrame:CGRectMake(0, 0, 242, 274)];
_candyTreeView.backgroundColor = [UIColor clearColor];
_candyTreeView.contentMode = UIViewContentModeScaleAspectFill;
}
return _candyTreeView;
}
- (XPRoomGiftAnimationParser *)vapParser {
if (!_vapParser) {
_vapParser = [[XPRoomGiftAnimationParser alloc] init];
}
return _vapParser;
}
@end

View File

@@ -374,26 +374,26 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
[self.presenter logout];
}
- (void)onLogin:(NIMLoginStep)step {
if(step == NIMLoginStepLoginOK) {
NSLog(@"登录陈宫");
NSString * uid = [AccountInfoStorage instance].getUid;
if ([QYSDK sharedSDK].currentUserID != uid) {
[[QYSDK sharedSDK] logout:^(BOOL success) {
if (success) {
QYUserInfo * userinfo = [[QYUserInfo alloc] init];
userinfo.userId = uid;
[[QYSDK sharedSDK] setUserInfo:userinfo];
}
}];
} else {
QYUserInfo * userinfo = [[QYUserInfo alloc] init];
userinfo.userId = uid;
[[QYSDK sharedSDK] setUserInfo:userinfo];
}
}
}
//- (void)onLogin:(NIMLoginStep)step {
// if(step == NIMLoginStepLoginOK) {
// NSLog(@"登录陈宫");
// NSString * uid = [AccountInfoStorage instance].getUid;
// if ([QYSDK sharedSDK].currentUserID != uid) {
// [[QYSDK sharedSDK] logout:^(BOOL success) {
// if (success) {
// QYUserInfo * userinfo = [[QYUserInfo alloc] init];
// userinfo.userId = uid;
// [[QYSDK sharedSDK] setUserInfo:userinfo];
// }
// }];
//
// } else {
// QYUserInfo * userinfo = [[QYUserInfo alloc] init];
// userinfo.userId = uid;
// [[QYSDK sharedSDK] setUserInfo:userinfo];
// }
// }
//}
- (void)onKickout:(NIMLoginKickoutResult *)result {
[XCHUDTool showErrorWithMessage:@"您已被踢下线,若非正常行为,请及时修改密码"];

Binary file not shown.