增加ShareView&TTPopup
1
Podfile
@@ -11,6 +11,7 @@ target 'xplan-ios' do
|
||||
pod 'Masonry'
|
||||
pod 'ReactiveObjC'
|
||||
pod 'MBProgressHUD'
|
||||
pod 'FFPopup'
|
||||
#易盾 本机一键登录
|
||||
pod 'NTESQuickPass', '~> 2.1.6'
|
||||
#模型转化
|
||||
|
@@ -14,6 +14,7 @@ PODS:
|
||||
- AFNetworking/Serialization (4.0.1)
|
||||
- AFNetworking/UIKit (4.0.1):
|
||||
- AFNetworking/NSURLSession
|
||||
- FFPopup (1.1.5)
|
||||
- Masonry (1.1.0)
|
||||
- MBProgressHUD (1.2.0)
|
||||
- MJExtension (3.3.0)
|
||||
@@ -42,6 +43,7 @@ PODS:
|
||||
|
||||
DEPENDENCIES:
|
||||
- AFNetworking
|
||||
- FFPopup
|
||||
- Masonry
|
||||
- MBProgressHUD
|
||||
- MJExtension
|
||||
@@ -58,6 +60,7 @@ DEPENDENCIES:
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- AFNetworking
|
||||
- FFPopup
|
||||
- Masonry
|
||||
- MBProgressHUD
|
||||
- MJExtension
|
||||
@@ -71,6 +74,7 @@ SPEC REPOS:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
|
||||
FFPopup: a208dcee8db3e54ec4a88fcd6481f6f5d85b7a83
|
||||
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
|
||||
MBProgressHUD: 3ee5efcc380f6a79a7cc9b363dd669c5e1ae7406
|
||||
MJExtension: 01704cca2b60a214c10761b6491eab74069d68a9
|
||||
@@ -82,6 +86,6 @@ SPEC CHECKSUMS:
|
||||
SZTextView: 094dc6acc9beec537685c545d6e3e0d4975174e1
|
||||
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
|
||||
|
||||
PODFILE CHECKSUM: 2113c2073e538f8e2ce75dd6607e53e5fabd0086
|
||||
PODFILE CHECKSUM: d5910ffe3f02430dd36728a17554f28258564c74
|
||||
|
||||
COCOAPODS: 1.10.1
|
||||
|
@@ -15,6 +15,18 @@
|
||||
186A52E526FC559200D67B2C /* AliyunOSSiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 186A52DF26FC559200D67B2C /* AliyunOSSiOS.framework */; };
|
||||
186A52E726FC559700D67B2C /* yw_1222_0769.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 186A52E626FC559700D67B2C /* yw_1222_0769.jpg */; };
|
||||
186A531926FC592100D67B2C /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 186A531826FC591100D67B2C /* libresolv.tbd */; };
|
||||
186A534626FC6ED900D67B2C /* TTPopup.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A532C26FC6ED900D67B2C /* TTPopup.m */; };
|
||||
186A534726FC6ED900D67B2C /* TTAlertConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A532E26FC6ED900D67B2C /* TTAlertConfig.m */; };
|
||||
186A534826FC6ED900D67B2C /* TTAlertButtonConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A533326FC6ED900D67B2C /* TTAlertButtonConfig.m */; };
|
||||
186A534926FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A533426FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m */; };
|
||||
186A534A26FC6ED900D67B2C /* TTActionSheetConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A533526FC6ED900D67B2C /* TTActionSheetConfig.m */; };
|
||||
186A534B26FC6ED900D67B2C /* TTPopupManagerService.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A533926FC6ED900D67B2C /* TTPopupManagerService.m */; };
|
||||
186A534C26FC6ED900D67B2C /* TTAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A533C26FC6ED900D67B2C /* TTAlertView.m */; };
|
||||
186A534D26FC6ED900D67B2C /* TTActionSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A533F26FC6ED900D67B2C /* TTActionSheetView.m */; };
|
||||
186A534E26FC6ED900D67B2C /* TTPopupService.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A534126FC6ED900D67B2C /* TTPopupService.m */; };
|
||||
186A536926FC6F2E00D67B2C /* XCShareView.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A536126FC6F2E00D67B2C /* XCShareView.m */; };
|
||||
186A536A26FC6F2E00D67B2C /* XCShareItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A536426FC6F2E00D67B2C /* XCShareItem.m */; };
|
||||
186A536B26FC6F2E00D67B2C /* XCShareItemCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 186A536726FC6F2E00D67B2C /* XCShareItemCell.m */; };
|
||||
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEDB26E89B32002833B2 /* BaseModel.m */; };
|
||||
187EEEE126E89BFB002833B2 /* AccountModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEE026E89BFB002833B2 /* AccountModel.m */; };
|
||||
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 187EEEEE26E89FE8002833B2 /* AccountInfoStorage.m */; };
|
||||
@@ -188,6 +200,33 @@
|
||||
186A52DF26FC559200D67B2C /* AliyunOSSiOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AliyunOSSiOS.framework; sourceTree = "<group>"; };
|
||||
186A52E626FC559700D67B2C /* yw_1222_0769.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = yw_1222_0769.jpg; sourceTree = "<group>"; };
|
||||
186A531826FC591100D67B2C /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; };
|
||||
186A532C26FC6ED900D67B2C /* TTPopup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTPopup.m; sourceTree = "<group>"; };
|
||||
186A532E26FC6ED900D67B2C /* TTAlertConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTAlertConfig.m; sourceTree = "<group>"; };
|
||||
186A532F26FC6ED900D67B2C /* TTAlertMessageAttributedConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTAlertMessageAttributedConfig.h; sourceTree = "<group>"; };
|
||||
186A533026FC6ED900D67B2C /* TTAlertButtonConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTAlertButtonConfig.h; sourceTree = "<group>"; };
|
||||
186A533126FC6ED900D67B2C /* TTActionSheetConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTActionSheetConfig.h; sourceTree = "<group>"; };
|
||||
186A533226FC6ED900D67B2C /* TTAlertConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTAlertConfig.h; sourceTree = "<group>"; };
|
||||
186A533326FC6ED900D67B2C /* TTAlertButtonConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTAlertButtonConfig.m; sourceTree = "<group>"; };
|
||||
186A533426FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTAlertMessageAttributedConfig.m; sourceTree = "<group>"; };
|
||||
186A533526FC6ED900D67B2C /* TTActionSheetConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTActionSheetConfig.m; sourceTree = "<group>"; };
|
||||
186A533726FC6ED900D67B2C /* TTPopupManagerServiceProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTPopupManagerServiceProtocol.h; sourceTree = "<group>"; };
|
||||
186A533826FC6ED900D67B2C /* TTPopupManagerService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTPopupManagerService.h; sourceTree = "<group>"; };
|
||||
186A533926FC6ED900D67B2C /* TTPopupManagerService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTPopupManagerService.m; sourceTree = "<group>"; };
|
||||
186A533A26FC6ED900D67B2C /* TTPopup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTPopup.h; sourceTree = "<group>"; };
|
||||
186A533C26FC6ED900D67B2C /* TTAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTAlertView.m; sourceTree = "<group>"; };
|
||||
186A533D26FC6ED900D67B2C /* TTActionSheetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTActionSheetView.h; sourceTree = "<group>"; };
|
||||
186A533E26FC6ED900D67B2C /* TTAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTAlertView.h; sourceTree = "<group>"; };
|
||||
186A533F26FC6ED900D67B2C /* TTActionSheetView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTActionSheetView.m; sourceTree = "<group>"; };
|
||||
186A534126FC6ED900D67B2C /* TTPopupService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTPopupService.m; sourceTree = "<group>"; };
|
||||
186A534226FC6ED900D67B2C /* TTPopupServiceProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTPopupServiceProtocol.h; sourceTree = "<group>"; };
|
||||
186A534326FC6ED900D67B2C /* TTPopupService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTPopupService.h; sourceTree = "<group>"; };
|
||||
186A534526FC6ED900D67B2C /* TTPopupConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TTPopupConstants.h; sourceTree = "<group>"; };
|
||||
186A536126FC6F2E00D67B2C /* XCShareView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XCShareView.m; sourceTree = "<group>"; };
|
||||
186A536226FC6F2E00D67B2C /* XCShareView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCShareView.h; sourceTree = "<group>"; };
|
||||
186A536426FC6F2E00D67B2C /* XCShareItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XCShareItem.m; sourceTree = "<group>"; };
|
||||
186A536526FC6F2E00D67B2C /* XCShareItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCShareItem.h; sourceTree = "<group>"; };
|
||||
186A536726FC6F2E00D67B2C /* XCShareItemCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XCShareItemCell.m; sourceTree = "<group>"; };
|
||||
186A536826FC6F2E00D67B2C /* XCShareItemCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XCShareItemCell.h; sourceTree = "<group>"; };
|
||||
187EEEDA26E89B32002833B2 /* BaseModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseModel.h; sourceTree = "<group>"; };
|
||||
187EEEDB26E89B32002833B2 /* BaseModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseModel.m; sourceTree = "<group>"; };
|
||||
187EEEDF26E89BFB002833B2 /* AccountModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountModel.h; sourceTree = "<group>"; };
|
||||
@@ -489,6 +528,103 @@
|
||||
path = RPSDK;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A532B26FC6ED900D67B2C /* TTPopup */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A532C26FC6ED900D67B2C /* TTPopup.m */,
|
||||
186A532D26FC6ED900D67B2C /* Config */,
|
||||
186A533626FC6ED900D67B2C /* Manager */,
|
||||
186A533A26FC6ED900D67B2C /* TTPopup.h */,
|
||||
186A533B26FC6ED900D67B2C /* View */,
|
||||
186A534026FC6ED900D67B2C /* Service */,
|
||||
186A534426FC6ED900D67B2C /* Header */,
|
||||
);
|
||||
path = TTPopup;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A532D26FC6ED900D67B2C /* Config */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A533226FC6ED900D67B2C /* TTAlertConfig.h */,
|
||||
186A532E26FC6ED900D67B2C /* TTAlertConfig.m */,
|
||||
186A533126FC6ED900D67B2C /* TTActionSheetConfig.h */,
|
||||
186A533526FC6ED900D67B2C /* TTActionSheetConfig.m */,
|
||||
186A533026FC6ED900D67B2C /* TTAlertButtonConfig.h */,
|
||||
186A533326FC6ED900D67B2C /* TTAlertButtonConfig.m */,
|
||||
186A532F26FC6ED900D67B2C /* TTAlertMessageAttributedConfig.h */,
|
||||
186A533426FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m */,
|
||||
);
|
||||
path = Config;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A533626FC6ED900D67B2C /* Manager */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A533726FC6ED900D67B2C /* TTPopupManagerServiceProtocol.h */,
|
||||
186A533826FC6ED900D67B2C /* TTPopupManagerService.h */,
|
||||
186A533926FC6ED900D67B2C /* TTPopupManagerService.m */,
|
||||
);
|
||||
path = Manager;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A533B26FC6ED900D67B2C /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A533E26FC6ED900D67B2C /* TTAlertView.h */,
|
||||
186A533C26FC6ED900D67B2C /* TTAlertView.m */,
|
||||
186A533D26FC6ED900D67B2C /* TTActionSheetView.h */,
|
||||
186A533F26FC6ED900D67B2C /* TTActionSheetView.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A534026FC6ED900D67B2C /* Service */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A534326FC6ED900D67B2C /* TTPopupService.h */,
|
||||
186A534126FC6ED900D67B2C /* TTPopupService.m */,
|
||||
186A534226FC6ED900D67B2C /* TTPopupServiceProtocol.h */,
|
||||
);
|
||||
path = Service;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A534426FC6ED900D67B2C /* Header */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A534526FC6ED900D67B2C /* TTPopupConstants.h */,
|
||||
);
|
||||
path = Header;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A536026FC6F2E00D67B2C /* ShareView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A536226FC6F2E00D67B2C /* XCShareView.h */,
|
||||
186A536126FC6F2E00D67B2C /* XCShareView.m */,
|
||||
186A536326FC6F2E00D67B2C /* Model */,
|
||||
186A536626FC6F2E00D67B2C /* View */,
|
||||
);
|
||||
path = ShareView;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A536326FC6F2E00D67B2C /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A536526FC6F2E00D67B2C /* XCShareItem.h */,
|
||||
186A536426FC6F2E00D67B2C /* XCShareItem.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
186A536626FC6F2E00D67B2C /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
186A536826FC6F2E00D67B2C /* XCShareItemCell.h */,
|
||||
186A536726FC6F2E00D67B2C /* XCShareItemCell.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
187EEEA926E62679002833B2 /* Api */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -639,13 +775,15 @@
|
||||
children = (
|
||||
E8AC720A26F435AF007D6E91 /* UIImageView */,
|
||||
E81366F926F0D27A0076364C /* UIButton */,
|
||||
E82109B126F2050D00FC3319 /* UIImage */,
|
||||
186A532B26FC6ED900D67B2C /* TTPopup */,
|
||||
186A536026FC6F2E00D67B2C /* ShareView */,
|
||||
189DD54926DE338800AB55B1 /* BaseViewController.h */,
|
||||
189DD54A26DE338800AB55B1 /* BaseViewController.m */,
|
||||
9B0E1C5726E77022005D4442 /* BaseNavigationController.h */,
|
||||
9B0E1C5826E77022005D4442 /* BaseNavigationController.m */,
|
||||
18E7B26826E8D5D60064BC9B /* XCCurrentVCStackManager.h */,
|
||||
18E7B26726E8D5D60064BC9B /* XCCurrentVCStackManager.m */,
|
||||
E82109B126F2050D00FC3319 /* UIImage */,
|
||||
189DD68326E1FDBB00AB55B1 /* XCHUDTool.h */,
|
||||
189DD68226E1FDBB00AB55B1 /* XCHUDTool.m */,
|
||||
E8B825CB26EA18C8009E8E9F /* ThemeColor.h */,
|
||||
@@ -1300,6 +1438,7 @@
|
||||
189DD6FF26E20E5900AB55B1 /* HttpRequestHelper.m in Sources */,
|
||||
E8E70D9226F2F60C00F03460 /* XPMineItemModel.m in Sources */,
|
||||
189DD74A26E21D8400AB55B1 /* SSKeychain.m in Sources */,
|
||||
186A534926FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m in Sources */,
|
||||
E81C27AE26EF39AB0031E639 /* AppDelegate+ThirdConfig.m in Sources */,
|
||||
E8E70D8326F2F51A00F03460 /* XPMineHeadView.m in Sources */,
|
||||
E8B825D026EA3825009E8E9F /* LoginPasswordViewController.m in Sources */,
|
||||
@@ -1307,6 +1446,7 @@
|
||||
E8AC721326F46ADD007D6E91 /* XPMineSettingViewController.m in Sources */,
|
||||
18E7B32126F098650064BC9B /* UserInfoSkillVo.m in Sources */,
|
||||
E8AC722726F482A4007D6E91 /* XPMineFeedbackPresenter.m in Sources */,
|
||||
186A534E26FC6ED900D67B2C /* TTPopupService.m in Sources */,
|
||||
E8AC722426F47E5E007D6E91 /* XPMineFeedbackViewController.m in Sources */,
|
||||
E81366E326F0A1FC0076364C /* LoginBindPhoneViewController.m in Sources */,
|
||||
189DD68426E1FDBB00AB55B1 /* XCHUDTool.m in Sources */,
|
||||
@@ -1315,6 +1455,7 @@
|
||||
E824544326F58FCE00BE8163 /* XPMinePayPwdInputView.m in Sources */,
|
||||
9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */,
|
||||
E824544626F5934700BE8163 /* XPMinePayPwdPresenter.m in Sources */,
|
||||
186A536A26FC6F2E00D67B2C /* XCShareItem.m in Sources */,
|
||||
189DD54B26DE338800AB55B1 /* BaseViewController.m in Sources */,
|
||||
E8E70D8626F2F55C00F03460 /* XPMineAccountView.m in Sources */,
|
||||
E81C279026EB314D0031E639 /* LoginForgetEditView.m in Sources */,
|
||||
@@ -1324,10 +1465,12 @@
|
||||
E824546126F5F4E400BE8163 /* XPMineResetPayPwdViewController.m in Sources */,
|
||||
E8B825C226EA00DF009E8E9F /* LoginVerifCodePresent.m in Sources */,
|
||||
E88B5CB026FB1C6500DA9178 /* XPMineTeenagerPresenter.m in Sources */,
|
||||
186A534B26FC6ED900D67B2C /* TTPopupManagerService.m in Sources */,
|
||||
18E7B1B226E8AF980064BC9B /* MainPresenter.m in Sources */,
|
||||
E81366F626F0C0DF0076364C /* LoginFullInfoPresenter.m in Sources */,
|
||||
189DD67E26E1FD8900AB55B1 /* UIImage+Utils.m in Sources */,
|
||||
E824545626F5E51900BE8163 /* XPMineVerifIdentityViewController.m in Sources */,
|
||||
186A534726FC6ED900D67B2C /* TTAlertConfig.m in Sources */,
|
||||
18E7B31E26F0984C0064BC9B /* UserLevelVo.m in Sources */,
|
||||
18E7B31B26F0982E0064BC9B /* UserExpand.m in Sources */,
|
||||
E824543526F57D6E00BE8163 /* XPLoginVerifBindPhoneViewController.m in Sources */,
|
||||
@@ -1339,6 +1482,7 @@
|
||||
E8AC722C26F49580007D6E91 /* XPMineNotificaViewController.m in Sources */,
|
||||
189DD52E26DE255300AB55B1 /* AppDelegate.m in Sources */,
|
||||
E8E70D8C26F2F5A500F03460 /* XPMineMatchCollectionViewCell.m in Sources */,
|
||||
186A534A26FC6ED900D67B2C /* TTActionSheetConfig.m in Sources */,
|
||||
E81C279326EB394D0031E639 /* LoginForgetPasswordViewController.m in Sources */,
|
||||
E81C278D26EAFAF60031E639 /* DESEncrypt.m in Sources */,
|
||||
E81366E726F0A49E0076364C /* NSString+Regex.m in Sources */,
|
||||
@@ -1351,14 +1495,19 @@
|
||||
E8AC721C26F4720B007D6E91 /* XPMineSettingPresent.m in Sources */,
|
||||
E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */,
|
||||
18C17A5D26F338F300C48E11 /* XplanFBFlutterViewContainer.m in Sources */,
|
||||
186A536926FC6F2E00D67B2C /* XCShareView.m in Sources */,
|
||||
186A534C26FC6ED900D67B2C /* TTAlertView.m in Sources */,
|
||||
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */,
|
||||
187EEEF026E89FE8002833B2 /* AccountInfoStorage.m in Sources */,
|
||||
186A536B26FC6F2E00D67B2C /* XCShareItemCell.m in Sources */,
|
||||
E872309326E8D31500B90D4F /* LoginVerifCodeView.m in Sources */,
|
||||
186A534626FC6ED900D67B2C /* TTPopup.m in Sources */,
|
||||
E81C278C26EAFAF60031E639 /* Base64.m in Sources */,
|
||||
189DD73D26E21C3F00AB55B1 /* YYUtility+Device.m in Sources */,
|
||||
187EEEDC26E89B32002833B2 /* BaseModel.m in Sources */,
|
||||
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */,
|
||||
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */,
|
||||
186A534D26FC6ED900D67B2C /* TTActionSheetView.m in Sources */,
|
||||
E824545926F5E65900BE8163 /* XPMineVerifIdentityView.m in Sources */,
|
||||
189DD74026E21C3F00AB55B1 /* YYUtility+App.m in Sources */,
|
||||
189DD74526E21CCC00AB55B1 /* YYReachability.m in Sources */,
|
||||
@@ -1368,6 +1517,7 @@
|
||||
E8AC722126F47E23007D6E91 /* XPMineAboutUsViewController.m in Sources */,
|
||||
E8AC721626F46B06007D6E91 /* XPMineSettingTableViewCell.m in Sources */,
|
||||
189DD75026E21D9000AB55B1 /* GCDHelper.m in Sources */,
|
||||
186A534826FC6ED900D67B2C /* TTAlertButtonConfig.m in Sources */,
|
||||
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */,
|
||||
18E7B29026EA0E6B0064BC9B /* FlutterBoost+Xplan.m in Sources */,
|
||||
189DD75926E6003C00AB55B1 /* Api.m in Sources */,
|
||||
|
6
xplan-ios/Assets.xcassets/Common/Share/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
22
xplan-ios/Assets.xcassets/Common/Share/share_friend.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_friend@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_friend@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_friend.imageset/share_friend@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_friend.imageset/share_friend@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.8 KiB |
22
xplan-ios/Assets.xcassets/Common/Share/share_qq.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_qq@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_qq@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_qq.imageset/share_qq@2x.png
vendored
Normal file
After Width: | Height: | Size: 943 B |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_qq.imageset/share_qq@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.7 KiB |
22
xplan-ios/Assets.xcassets/Common/Share/share_qq_disable.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_qq_disable@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_qq_disable@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_qq_disable.imageset/share_qq_disable@2x.png
vendored
Normal file
After Width: | Height: | Size: 856 B |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_qq_disable.imageset/share_qq_disable@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.5 KiB |
22
xplan-ios/Assets.xcassets/Common/Share/share_qqzone.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_qqzone@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_qqzone@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_qqzone.imageset/share_qqzone@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_qqzone.imageset/share_qqzone@3x.png
vendored
Normal file
After Width: | Height: | Size: 2.0 KiB |
22
xplan-ios/Assets.xcassets/Common/Share/share_qqzone_disable.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_qqzone_disable@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_qqzone_disable@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_qqzone_disable.imageset/share_qqzone_disable@2x.png
vendored
Normal file
After Width: | Height: | Size: 953 B |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_qqzone_disable.imageset/share_qqzone_disable@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.7 KiB |
22
xplan-ios/Assets.xcassets/Common/Share/share_wx.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_wx@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_wx@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_wx.imageset/share_wx@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_wx.imageset/share_wx@3x.png
vendored
Normal file
After Width: | Height: | Size: 2.1 KiB |
22
xplan-ios/Assets.xcassets/Common/Share/share_wx_disable.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_wx_disable@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_wx_disable@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_wx_disable.imageset/share_wx_disable@2x.png
vendored
Normal file
After Width: | Height: | Size: 1013 B |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_wx_disable.imageset/share_wx_disable@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.7 KiB |
22
xplan-ios/Assets.xcassets/Common/Share/share_wxcircle.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_wxcircle@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_wxcircle@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_wxcircle.imageset/share_wxcircle@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_wxcircle.imageset/share_wxcircle@3x.png
vendored
Normal file
After Width: | Height: | Size: 2.1 KiB |
22
xplan-ios/Assets.xcassets/Common/Share/share_wxcircle_disable.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_wxcircle_disable@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "share_wxcircle_disable@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Common/Share/share_wxcircle_disable.imageset/share_wxcircle_disable@2x.png
vendored
Normal file
After Width: | Height: | Size: 985 B |
BIN
xplan-ios/Assets.xcassets/Common/Share/share_wxcircle_disable.imageset/share_wxcircle_disable@3x.png
vendored
Normal file
After Width: | Height: | Size: 1.7 KiB |
34
xplan-ios/Base/UI/ShareView/Model/XCShareItem.h
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// XCShareItem.h
|
||||
// XCRoomMoudle
|
||||
//
|
||||
// Created by KevinWang on 2018/9/2.
|
||||
// Copyright © 2018年 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
XCShareItemTagReport, //举报
|
||||
XCShareItemTagAppFriends, //应用好友
|
||||
XCShareItemTagWeChat, //微信好友
|
||||
XCShareItemTagMoments, //微信朋友圈
|
||||
XCShareItemTagQQ, //QQ好友
|
||||
XCShareItemTagQQZone, //QQ空间
|
||||
XCShareItemTagWeibo, //新浪微博
|
||||
XCShareItemTagDelete,//删除
|
||||
XCShareItemTagCopyright,//版权
|
||||
XCShare_Platfrom_Type_FaceBook, //FaceBook
|
||||
} XCShareItemTag;
|
||||
|
||||
@interface XCShareItem : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
@property (nonatomic, copy) NSString *imageName;
|
||||
@property (nonatomic, copy) NSString *disableImageName;
|
||||
@property (nonatomic, assign) BOOL disable;
|
||||
@property (nonatomic, assign) XCShareItemTag itemTag;
|
||||
|
||||
+ (instancetype)itemWitTag:(XCShareItemTag)itemTag title:(NSString *)title imageName:(NSString *)imageName disableImageName:(NSString *)disableImageName disable:(BOOL)disable;
|
||||
|
||||
@end
|
23
xplan-ios/Base/UI/ShareView/Model/XCShareItem.m
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// XCShareItem.m
|
||||
// XCRoomMoudle
|
||||
//
|
||||
// Created by KevinWang on 2018/9/2.
|
||||
// Copyright © 2018年 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XCShareItem.h"
|
||||
|
||||
@implementation XCShareItem
|
||||
|
||||
+ (instancetype)itemWitTag:(XCShareItemTag)itemTag title:(NSString *)title imageName:(NSString *)imageName disableImageName:(NSString *)disableImageName disable:(BOOL)disable{
|
||||
XCShareItem *item = [[self alloc] init];
|
||||
item.itemTag = itemTag;
|
||||
item.title = title;
|
||||
item.imageName = imageName;
|
||||
item.disableImageName = disableImageName;
|
||||
item.disable = disable;
|
||||
return item;
|
||||
}
|
||||
|
||||
@end
|
16
xplan-ios/Base/UI/ShareView/View/XCShareItemCell.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XCShareItemCell.h
|
||||
// XCRoomMoudle
|
||||
//
|
||||
// Created by KevinWang on 2018/9/2.
|
||||
// Copyright © 2018年 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XCShareItem.h"
|
||||
|
||||
@interface XCShareItemCell : UICollectionViewCell
|
||||
|
||||
@property (nonatomic, strong) XCShareItem *shareItem;
|
||||
|
||||
@end
|
80
xplan-ios/Base/UI/ShareView/View/XCShareItemCell.m
Normal file
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// XCShareItemCell.m
|
||||
// XCRoomMoudle
|
||||
//
|
||||
// Created by KevinWang on 2018/9/2.
|
||||
// Copyright © 2018年 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XCShareItemCell.h"
|
||||
#import "ThemeColor.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
@interface XCShareItemCell()
|
||||
|
||||
@property (nonatomic, strong) UIImageView *iconImageView;
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XCShareItemCell
|
||||
|
||||
#pragma mark - Life Style
|
||||
- (instancetype)initWithFrame:(CGRect)frame{
|
||||
if (self=[super initWithFrame:frame]) {
|
||||
[self setupSubviews];
|
||||
[self setupSubviewsConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - puble method
|
||||
- (void)setShareItem:(XCShareItem *)shareItem{
|
||||
_shareItem = shareItem;
|
||||
self.userInteractionEnabled = !shareItem.disable;
|
||||
if (shareItem.disable) {
|
||||
self.iconImageView.image = [UIImage imageNamed:shareItem.disableImageName];
|
||||
}else{
|
||||
self.iconImageView.image = [UIImage imageNamed:shareItem.imageName];
|
||||
}
|
||||
self.titleLabel.text = shareItem.title;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
- (void)setupSubviews{
|
||||
[self.contentView addSubview:self.iconImageView];
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
|
||||
}
|
||||
- (void)setupSubviewsConstraints{
|
||||
CGFloat wh = 30;
|
||||
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.height.equalTo(@(wh));
|
||||
make.bottom.equalTo(self.contentView.mas_centerY);
|
||||
make.centerX.equalTo(self.contentView);
|
||||
}];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.contentView);
|
||||
make.top.equalTo(self.iconImageView.mas_bottom).offset(10);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getter
|
||||
- (UIImageView *)iconImageView{
|
||||
if (!_iconImageView) {
|
||||
_iconImageView = [[UIImageView alloc] init];
|
||||
}
|
||||
return _iconImageView;
|
||||
}
|
||||
- (UILabel *)titleLabel{
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
@end
|
41
xplan-ios/Base/UI/ShareView/XCShareView.h
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// XCShareView.h
|
||||
// XCRoomMoudle
|
||||
//
|
||||
// Created by KevinWang on 2018/9/2.
|
||||
// Copyright © 2018年 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XCShareItem.h"
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
XCShareViewStyleCenter,
|
||||
XCShareViewStyleCenterAndBottom,
|
||||
XCShareViewStyleAll,
|
||||
} XCShareViewStyle;
|
||||
|
||||
@class XCShareView;
|
||||
@protocol XCShareViewDelegate <NSObject>
|
||||
|
||||
- (void)shareView:(XCShareView *)shareView didSelected:(XCShareItemTag)itemTag;
|
||||
- (void)shareViewDidClickCancle:(XCShareView *)shareView;
|
||||
|
||||
@end;
|
||||
|
||||
@interface XCShareView : UIView
|
||||
|
||||
@property (nonatomic, weak) id<XCShareViewDelegate> delegate;
|
||||
|
||||
- (instancetype)initWithItemSize:(CGSize)itemSize items:(NSArray<XCShareItem *> *)items margin:(CGFloat)margin;
|
||||
/**
|
||||
初始化XCShareView
|
||||
|
||||
@param itemSize 每个分享item的大小
|
||||
@param items 分享的item数据源
|
||||
@param edgeInsets 分享item距离容器的上下左右间距
|
||||
@return XCShareView
|
||||
*/
|
||||
- (instancetype)initWithShareViewStyle:(XCShareViewStyle)style items:(NSArray<XCShareItem *> *)items itemSize:(CGSize)itemSize edgeInsets:(UIEdgeInsets)edgeInsets ;
|
||||
|
||||
@end
|
204
xplan-ios/Base/UI/ShareView/XCShareView.m
Normal file
@@ -0,0 +1,204 @@
|
||||
//
|
||||
// XCShareView.m
|
||||
// XCRoomMoudle
|
||||
//
|
||||
// Created by KevinWang on 2018/9/2.
|
||||
// Copyright © 2018年 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "XCShareView.h"
|
||||
#import "XCShareItemCell.h"
|
||||
#import "XPMacro.h"
|
||||
#import "ThemeColor.h"
|
||||
|
||||
@interface XCShareView()<UICollectionViewDataSource,UICollectionViewDelegate>
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
@property (nonatomic, strong) UILabel *tipLabel;
|
||||
@property (nonatomic, strong) UIButton *cancleButton;
|
||||
|
||||
@property (nonatomic, strong) UICollectionView *collectionView;
|
||||
@property (nonatomic, strong) NSArray<XCShareItem *> *items;
|
||||
@property (nonatomic, assign) CGSize itemSize;
|
||||
@property (nonatomic, assign) CGFloat margin;
|
||||
@property (nonatomic, assign) UIEdgeInsets edgeInsets;
|
||||
@property (nonatomic, strong) UIView *contianterView;//容器
|
||||
@property (nonatomic, assign) CGFloat collectionH;
|
||||
|
||||
@property (nonatomic, assign) XCShareViewStyle shareViewStyle;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XCShareView
|
||||
|
||||
|
||||
#pragma mark - Life Style
|
||||
- (instancetype)initWithItemSize:(CGSize)itemSize items:(NSArray<XCShareItem *> *)items margin:(CGFloat)margin{
|
||||
return [self initWithShareViewStyle:XCShareViewStyleCenter items:items itemSize:itemSize edgeInsets:UIEdgeInsetsMake(0, margin, 0, margin)];
|
||||
}
|
||||
|
||||
- (instancetype)initWithShareViewStyle:(XCShareViewStyle)style items:(NSArray<XCShareItem *> *)items itemSize:(CGSize)itemSize edgeInsets:(UIEdgeInsets)edgeInsets{
|
||||
|
||||
_shareViewStyle = style;
|
||||
_items = items;
|
||||
_itemSize = itemSize;
|
||||
_edgeInsets = edgeInsets;
|
||||
if (self=[super init]) {
|
||||
[self setupSubviews];
|
||||
[self makeConstriants];
|
||||
[self configASMRUI];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UICollectionViewDelegate
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.items.count;
|
||||
}
|
||||
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
XCShareItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"XCShareItemCell" forIndexPath:indexPath];
|
||||
cell.shareItem = self.items[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
NSLog(@"%@",[self.items[indexPath.item] title]);
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(shareView:didSelected:)]) {
|
||||
XCShareItem *item = self.items[indexPath.item];
|
||||
[self.delegate shareView:self didSelected:item.itemTag];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - event response
|
||||
- (void)cancleButtonDidClck:(UIButton *)button{
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(shareViewDidClickCancle:)]) {
|
||||
[self.delegate shareViewDidClickCancle:self];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)setupSubviews{
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
[self addSubview:self.contianterView];
|
||||
|
||||
if (self.shareViewStyle == XCShareViewStyleAll) {
|
||||
[self.contianterView addSubview:self.titleLabel];
|
||||
[self.contianterView addSubview:self.tipLabel];
|
||||
}
|
||||
|
||||
[self.contianterView addSubview:self.collectionView];
|
||||
|
||||
if (self.shareViewStyle == XCShareViewStyleCenterAndBottom || self.shareViewStyle == XCShareViewStyleAll) {
|
||||
[self.contianterView addSubview:self.cancleButton];
|
||||
}
|
||||
|
||||
[self.collectionView registerClass:[XCShareItemCell class] forCellWithReuseIdentifier:@"XCShareItemCell"];
|
||||
}
|
||||
|
||||
- (void)makeConstriants{
|
||||
int collectionWidth = KScreenWidth-self.edgeInsets.left-self.edgeInsets.right;
|
||||
int offset = (int)(self.items.count * self.itemSize.width) % collectionWidth;
|
||||
int row = self.items.count * self.itemSize.width / collectionWidth ;
|
||||
self.collectionH = (offset == 0 ? self.itemSize.height*row : self.itemSize.height*(row+1));
|
||||
|
||||
int cancleButtonH = 44;
|
||||
|
||||
if (self.shareViewStyle == XCShareViewStyleCenter) {
|
||||
|
||||
self.frame = CGRectMake(0, 0, KScreenWidth, self.collectionH + self.edgeInsets.top+self.edgeInsets.bottom + kSafeAreaBottomHeight);
|
||||
self.collectionView.frame = CGRectMake(self.edgeInsets.left, self.edgeInsets.top, collectionWidth, self.collectionH);
|
||||
|
||||
}else if (self.shareViewStyle == XCShareViewStyleCenterAndBottom){
|
||||
|
||||
self.frame = CGRectMake(0, 0, KScreenWidth, self.collectionH + self.edgeInsets.top+self.edgeInsets.bottom + cancleButtonH + kSafeAreaBottomHeight);
|
||||
self.collectionView.frame = CGRectMake(self.edgeInsets.left, self.edgeInsets.top, collectionWidth, self.collectionH);
|
||||
self.cancleButton.frame = CGRectMake(0, CGRectGetMaxY(self.collectionView.frame)+self.edgeInsets.bottom, KScreenWidth, cancleButtonH);
|
||||
|
||||
}else if (self.shareViewStyle == XCShareViewStyleAll){
|
||||
|
||||
self.frame = CGRectMake(0, 0, KScreenWidth, self.collectionH + self.edgeInsets.top+self.edgeInsets.bottom + cancleButtonH + 55 + kSafeAreaBottomHeight);
|
||||
self.titleLabel.frame =CGRectMake(0, 18, KScreenWidth, 14);
|
||||
self.tipLabel.frame =CGRectMake(0, CGRectGetMaxY(self.titleLabel.frame)+10, KScreenWidth, 13);
|
||||
self.collectionView.frame = CGRectMake(self.edgeInsets.left, CGRectGetMaxY(self.tipLabel.frame)+self.edgeInsets.top, collectionWidth, self.collectionH);
|
||||
self.cancleButton.frame = CGRectMake(0, CGRectGetMaxY(self.collectionView.frame)+self.edgeInsets.bottom, KScreenWidth, cancleButtonH);
|
||||
}
|
||||
// 适配 iPhone X 系列安全区域
|
||||
self.contianterView.frame = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height - kSafeAreaBottomHeight);
|
||||
|
||||
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
|
||||
- (void)configASMRUI{
|
||||
|
||||
self.titleLabel.text = @"分享到";
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
self.titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
self.titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
|
||||
self.tipLabel.hidden = YES;
|
||||
self.cancleButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
|
||||
[self.cancleButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
}
|
||||
|
||||
- (UIView *)contianterView {
|
||||
if (!_contianterView) {
|
||||
_contianterView = [[UIView alloc] init];
|
||||
_contianterView.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
_contianterView.layer.cornerRadius = 14.0;
|
||||
_contianterView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _contianterView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel{
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
_titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
_titleLabel.text = @"分享给好友";
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
- (UILabel *)tipLabel{
|
||||
if (!_tipLabel) {
|
||||
_tipLabel = [[UILabel alloc] init];
|
||||
_tipLabel.font = [UIFont systemFontOfSize:13.0];
|
||||
_tipLabel.textColor = [ThemeColor mainTextColor];
|
||||
_tipLabel.textAlignment = NSTextAlignmentCenter;
|
||||
// _tipLabel.text = [NSString stringWithFormat:@"每天第一次分享免费领%@(不包含分享至%@好友)", [XCKeyWordTool sharedInstance].xcRedColor, MyAppName];
|
||||
}
|
||||
return _tipLabel;
|
||||
}
|
||||
|
||||
- (UICollectionView *)collectionView{
|
||||
if (!_collectionView) {
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
layout.itemSize = self.itemSize;
|
||||
layout.minimumInteritemSpacing = 0;
|
||||
layout.minimumLineSpacing = 0;
|
||||
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
|
||||
_collectionView.backgroundColor = [ThemeColor appCellBackgroundColor];
|
||||
_collectionView.dataSource = self;
|
||||
_collectionView.delegate = self;
|
||||
}
|
||||
return _collectionView;
|
||||
}
|
||||
|
||||
- (UIButton *)cancleButton{
|
||||
if (!_cancleButton) {
|
||||
_cancleButton = [[UIButton alloc] init];
|
||||
[_cancleButton setBackgroundColor:[ThemeColor appBackgroundColor]];
|
||||
[_cancleButton setTitle:@"取消" forState:UIControlStateNormal];
|
||||
_cancleButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
|
||||
[_cancleButton setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal];
|
||||
[_cancleButton addTarget:self action:@selector(cancleButtonDidClck:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _cancleButton;
|
||||
}
|
||||
|
||||
@end
|
57
xplan-ios/Base/UI/TTPopup/Config/TTActionSheetConfig.h
Normal file
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// TTActionSheetConfig.h
|
||||
// AFNetworking
|
||||
//
|
||||
// Created by lee on 2019/5/23.
|
||||
// action sheet item 配置
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef enum : NSUInteger {
|
||||
TTItemSelectNormal,
|
||||
TTItemSelectHighLight,
|
||||
} TTItemSelectType;
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
typedef void(^TTActionSheetClickAction)(void);
|
||||
|
||||
@interface TTActionSheetConfig : NSObject
|
||||
|
||||
/** 标题 */
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
|
||||
/**
|
||||
标题颜色
|
||||
*/
|
||||
@property (nonatomic, strong) UIColor *titleColor;
|
||||
|
||||
/** 是否选中 */
|
||||
@property (nonatomic, assign) TTItemSelectType type;
|
||||
|
||||
/** 点击事件 */
|
||||
@property (nonatomic, copy) TTActionSheetClickAction clickAction;
|
||||
|
||||
/**
|
||||
构建 actionSheet item 实例
|
||||
|
||||
@param title 标题
|
||||
@param clickAction 点击事件
|
||||
@return item 实例
|
||||
*/
|
||||
+ (TTActionSheetConfig *)normalTitle:(NSString *)title
|
||||
clickAction:(TTActionSheetClickAction)clickAction;
|
||||
+ (TTActionSheetConfig *)normalTitle:(NSString *)title
|
||||
selectColorType:(TTItemSelectType)type clickAction:(TTActionSheetClickAction)clickAction;
|
||||
|
||||
|
||||
/// 构建实例
|
||||
/// @param title 标题
|
||||
/// @param textColor 颜色
|
||||
/// @param handler 事件处理
|
||||
+ (TTActionSheetConfig *)actionWithTitle:(NSString *)title
|
||||
color:(UIColor *)textColor
|
||||
handler:(TTActionSheetClickAction)handler;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
48
xplan-ios/Base/UI/TTPopup/Config/TTActionSheetConfig.m
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// TTActionSheetConfig.m
|
||||
// AFNetworking
|
||||
//
|
||||
// Created by lee on 2019/5/23.
|
||||
//
|
||||
|
||||
#import "TTActionSheetConfig.h"
|
||||
#import "ThemeColor.h"
|
||||
|
||||
@implementation TTActionSheetConfig
|
||||
|
||||
/**
|
||||
构建 actionSheet item 实例
|
||||
|
||||
@param title 标题
|
||||
@param clickAction 点击事件
|
||||
@return item 实例
|
||||
*/
|
||||
+ (TTActionSheetConfig *)normalTitle:(NSString *)title clickAction:(TTActionSheetClickAction)clickAction {
|
||||
|
||||
return [self normalTitle:title selectColorType:TTItemSelectNormal clickAction:clickAction];
|
||||
}
|
||||
|
||||
+ (TTActionSheetConfig *)normalTitle:(NSString *)title selectColorType:(TTItemSelectType)type clickAction:(TTActionSheetClickAction)clickAction {
|
||||
|
||||
UIColor *color = type == TTItemSelectHighLight ? [ThemeColor alertTitleColor] : [ThemeColor alertTitleColor];
|
||||
|
||||
TTActionSheetConfig *config = [self actionWithTitle:title color:color handler:clickAction];
|
||||
config.type = type;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
+ (TTActionSheetConfig *)actionWithTitle:(NSString *)title
|
||||
color:(UIColor *)textColor
|
||||
handler:(TTActionSheetClickAction)handler {
|
||||
|
||||
TTActionSheetConfig *config = [[TTActionSheetConfig alloc] init];
|
||||
config.type = TTItemSelectNormal;
|
||||
config.title = title;
|
||||
config.titleColor = textColor;
|
||||
config.clickAction = handler;
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
@end
|
30
xplan-ios/Base/UI/TTPopup/Config/TTAlertButtonConfig.h
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// TTAlertButtonConfig.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
// alert 按钮配置
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TTAlertButtonConfig : NSObject
|
||||
/** 按钮标题 */
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
/** 按钮字体 */
|
||||
@property (nonatomic, strong) UIFont *font;
|
||||
/** 按钮字体颜色 */
|
||||
@property (nonatomic, strong) UIColor *titleColor;
|
||||
/** 背景色 */
|
||||
@property (nonatomic, strong) UIColor *backgroundColor;
|
||||
/** 背景图 */
|
||||
@property (nonatomic, strong) UIImage *backgroundImage;
|
||||
/** 圆角 */
|
||||
@property (nonatomic, assign) CGFloat cornerRadius;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
13
xplan-ios/Base/UI/TTPopup/Config/TTAlertButtonConfig.m
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TTAlertButtonConfig.m
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTAlertButtonConfig.h"
|
||||
|
||||
@implementation TTAlertButtonConfig
|
||||
|
||||
@end
|
75
xplan-ios/Base/UI/TTPopup/Config/TTAlertConfig.h
Normal file
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// TTAlertConfig.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/20.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
// alert 配置
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TTAlertButtonConfig.h"
|
||||
#import "TTAlertMessageAttributedConfig.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TTAlertConfig : NSObject
|
||||
|
||||
// 容器背景设置
|
||||
@property (nonatomic, strong) UIColor *backgroundColor;
|
||||
|
||||
// 标题设置
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
@property (nonatomic, strong) UIFont *titleFont;
|
||||
@property (nonatomic, strong) UIColor *titleColor;
|
||||
|
||||
// 内容设置
|
||||
@property (nonatomic, copy) NSString *message;
|
||||
@property (nonatomic, strong) UIFont *messageFont;
|
||||
@property (nonatomic, strong) UIColor *messageColor;
|
||||
/** 内容的行间距,默认不设置,当值为 0 或负数时无效 */
|
||||
@property (nonatomic, assign) CGFloat messageLineSpacing;
|
||||
/** 内容富文本配置 */
|
||||
@property (nonatomic, strong) NSArray<TTAlertMessageAttributedConfig *> *messageAttributedConfig;
|
||||
|
||||
// 取消按钮配置
|
||||
@property (nonatomic, strong) TTAlertButtonConfig *cancelButtonConfig;
|
||||
|
||||
// 确定按钮配置
|
||||
@property (nonatomic, strong) TTAlertButtonConfig *confirmButtonConfig;
|
||||
|
||||
/**
|
||||
背景蒙层的透明度
|
||||
@Description 默认是 000000 黑色 0.3 alpha
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat maskBackgroundAlpha;
|
||||
|
||||
// 圆角
|
||||
@property (nonatomic, assign) CGFloat cornerRadius;
|
||||
|
||||
// 点击蒙层是否消失,默认:YES
|
||||
@property (nonatomic, assign) BOOL shouldDismissOnBackgroundTouch;
|
||||
|
||||
/**
|
||||
点击‘确定’‘取消’按钮时禁止弹窗自动消失,默认:NO
|
||||
|
||||
@discussion 若值为 YES,需要主动调用 [TTPopup dismiss] 消除弹窗
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL disableAutoDismissWhenClickButton;
|
||||
|
||||
/**
|
||||
重复弹窗过滤,默认:NO
|
||||
|
||||
@discussion 设置过滤时,队列中将不会出现相同过滤标识的弹窗
|
||||
过滤标识通过 #<filterIdentifier> 设置
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL shouldFilterPopup;
|
||||
|
||||
/**
|
||||
过滤标识,默认:nil
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *filterIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
73
xplan-ios/Base/UI/TTPopup/Config/TTAlertConfig.m
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// TTAlertConfig.m
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/20.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTAlertConfig.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "ThemeColor.h"
|
||||
|
||||
static CGFloat kAlertTitleFont = 18.f;
|
||||
static CGFloat kAlertButtonFont = 15.f;
|
||||
static CGFloat kAlertMessageFont = 15.f;
|
||||
static CGFloat kAlertCornerRadius = 12.f;
|
||||
static CGFloat kAlertBackgroundColorAlpha = 0.3;
|
||||
static CGFloat kAlertMessageFontLineSpace = -1;
|
||||
static CGFloat kAlertButtonCornerRadius = 8.f;
|
||||
|
||||
@implementation TTAlertConfig
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
||||
_backgroundColor = [ThemeColor alertBackgroundColor];
|
||||
|
||||
//背景颜色
|
||||
kAlertTitleFont = 16.f;
|
||||
kAlertCornerRadius = 14.f;
|
||||
kAlertButtonCornerRadius = 19.f;
|
||||
|
||||
// title
|
||||
_title = @"";// 标题
|
||||
_titleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:kAlertTitleFont];// 字体
|
||||
_titleColor = [ThemeColor alertTitleColor];// 颜色
|
||||
|
||||
// message
|
||||
_message = @"";
|
||||
_messageFont = [UIFont systemFontOfSize:kAlertMessageFont];// 内容
|
||||
_messageColor = [ThemeColor alertMessageColor];// 颜色
|
||||
_messageLineSpacing = kAlertMessageFontLineSpace;// 字体行间距
|
||||
_messageAttributedConfig = @[];// 自定义富文本样式
|
||||
|
||||
// cancel button
|
||||
_cancelButtonConfig = [[TTAlertButtonConfig alloc] init];
|
||||
_cancelButtonConfig.title = @"取消";// 取消按钮
|
||||
_cancelButtonConfig.font = [UIFont systemFontOfSize:kAlertButtonFont];// 按钮字体
|
||||
_cancelButtonConfig.titleColor = [ThemeColor cancelButtonTextColor];// 字体颜色
|
||||
_cancelButtonConfig.backgroundImage = [UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor], [ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
_cancelButtonConfig.cornerRadius = kAlertButtonCornerRadius;// 按钮背景图
|
||||
|
||||
// confirm button
|
||||
_confirmButtonConfig = [[TTAlertButtonConfig alloc] init];
|
||||
_confirmButtonConfig.title = @"确定";
|
||||
_confirmButtonConfig.font = [UIFont systemFontOfSize:kAlertButtonFont];
|
||||
_confirmButtonConfig.titleColor = [ThemeColor confirmButtonTextColor];
|
||||
_confirmButtonConfig.backgroundImage = [UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
_confirmButtonConfig.cornerRadius = kAlertButtonCornerRadius;
|
||||
|
||||
_cornerRadius = kAlertCornerRadius;// 默认圆角
|
||||
_shouldDismissOnBackgroundTouch = YES;// 点击蒙层是否消失
|
||||
|
||||
// mask default 0.3 black
|
||||
_maskBackgroundAlpha = kAlertBackgroundColorAlpha; // alert 背景色
|
||||
_disableAutoDismissWhenClickButton = NO;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// TTAlertContentAttributedConfig.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
// alert 提示内容富文本配置
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TTAlertMessageAttributedConfig : NSObject
|
||||
|
||||
/** 富文本字段需要特殊显示的文本 */
|
||||
@property (nonatomic, copy) NSString *text;
|
||||
|
||||
/** 颜色 */
|
||||
@property (nonatomic, strong) UIColor *color;
|
||||
|
||||
/** 字体 */
|
||||
@property (nonatomic, strong) UIFont *font;
|
||||
|
||||
/**
|
||||
目标文本指定位置,一旦设置则无视 text 的值
|
||||
|
||||
@discussion 内容文本中出现相同的目标文本时,可通过设置 range 精确指定位置
|
||||
*/
|
||||
@property (nonatomic, assign) NSRange range;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TTAlertContentAttributedConfig.m
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTAlertMessageAttributedConfig.h"
|
||||
|
||||
@implementation TTAlertMessageAttributedConfig
|
||||
|
||||
@end
|
38
xplan-ios/Base/UI/TTPopup/Header/TTPopupConstants.h
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// TTPopupConstants.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/**
|
||||
Popup 组件通用回调
|
||||
*/
|
||||
typedef void(^TTPopupCompletionHandler)(void);
|
||||
|
||||
/**
|
||||
弹窗类型
|
||||
|
||||
- TTPopupStyleAlert: Alert
|
||||
- TTPopupStyleActionSheet: ActionSheet
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, TTPopupStyle) {
|
||||
TTPopupStyleAlert = 0,
|
||||
TTPopupStyleActionSheet
|
||||
};
|
||||
|
||||
/**
|
||||
弹窗优先级
|
||||
|
||||
- TTPopupPriorityNormal: 普通
|
||||
- TTPopupPriorityHigh: 高
|
||||
- TTPopupPriorityRequired: 必须
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, TTPopupPriority) {
|
||||
TTPopupPriorityNormal = 0,
|
||||
TTPopupPriorityHigh,
|
||||
TTPopupPriorityRequired
|
||||
};
|
24
xplan-ios/Base/UI/TTPopup/Manager/TTPopupManagerService.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// TTPopupManagerService.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "TTPopupManagerServiceProtocol.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TTPopupManagerService : NSObject<TTPopupManagerServiceProtocol>
|
||||
/**
|
||||
当前显示的弹窗服务
|
||||
*/
|
||||
@property (nonatomic, strong) id<TTPopupServiceProtocol> currentPopupService;
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
200
xplan-ios/Base/UI/TTPopup/Manager/TTPopupManagerService.m
Normal file
@@ -0,0 +1,200 @@
|
||||
//
|
||||
// TTPopupManagerService.m
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTPopupManagerService.h"
|
||||
|
||||
#import <FFPopup/FFPopup.h>
|
||||
|
||||
@interface TTPopupManagerService ()
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray< id<TTPopupServiceProtocol> > *queue;
|
||||
/**
|
||||
当前是否正在显示状态
|
||||
*/
|
||||
@property (nonatomic, assign, getter=isShowingPopup) BOOL showingPopup;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TTPopupManagerService
|
||||
|
||||
#pragma mark - Life Cycle
|
||||
+ (instancetype)sharedInstance {
|
||||
static TTPopupManagerService *instance = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[self alloc] init];
|
||||
});
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
_queue = [NSMutableArray array];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - TTPopupManagerServiceProtocol
|
||||
- (void)addPopupService:(id<TTPopupServiceProtocol>)service {
|
||||
if (![service conformsToProtocol:@protocol(TTPopupServiceProtocol)]) {
|
||||
return;
|
||||
}
|
||||
if ([_queue containsObject:service]) {
|
||||
return;
|
||||
}
|
||||
NSInteger insertPosition = [self insertPositionForPopupService:service];
|
||||
if (insertPosition == NSNotFound) {
|
||||
return;
|
||||
}
|
||||
[_queue insertObject:service atIndex:insertPosition];
|
||||
//当前没有弹窗显示且队列只有一个元素时,显示弹窗
|
||||
if (_currentPopupService == nil && _queue.count == 1) {
|
||||
[self showPopup];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removePopupService {
|
||||
|
||||
//防止当弹窗还未显示完成,在显示过程中频繁调用 dismiss
|
||||
//使得 _currentPopupService 被清空,导致弹窗无法消失,从而假死现象
|
||||
if (!self.isShowingPopup) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentPopupService == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_queue.count > 0) {
|
||||
[_queue removeObjectAtIndex:0];
|
||||
}
|
||||
|
||||
[FFPopup dismissPopupForView:_currentPopupService.contentView animated:YES];
|
||||
_currentPopupService = nil;
|
||||
}
|
||||
|
||||
/**
|
||||
点击蒙层时移除队列中的数据源
|
||||
|
||||
@discussion 注意无需调用 dismissPopupForView
|
||||
*/
|
||||
- (void)removeSourceWhenTouchMaskView {
|
||||
if (_currentPopupService == nil) {
|
||||
return;
|
||||
}
|
||||
if (_queue.count > 0) {
|
||||
[_queue removeObjectAtIndex:0];
|
||||
}
|
||||
_currentPopupService = nil;
|
||||
}
|
||||
|
||||
#pragma mark - Private Methods
|
||||
/**
|
||||
显示弹窗
|
||||
*/
|
||||
- (void)showPopup {
|
||||
if (self.isShowingPopup) {
|
||||
return;
|
||||
}
|
||||
if (_currentPopupService) {
|
||||
return;
|
||||
}
|
||||
if (_queue.count == 0) {
|
||||
return;
|
||||
}
|
||||
id<TTPopupServiceProtocol> popupService = _queue.firstObject;
|
||||
if (![popupService conformsToProtocol:@protocol(TTPopupServiceProtocol)]) {
|
||||
return;
|
||||
}
|
||||
_currentPopupService = popupService;
|
||||
FFPopupHorizontalLayout horizontalLayout = FFPopupHorizontalLayout_Center;
|
||||
FFPopupVerticalLayout verticalLayout = FFPopupVerticalLayout_Center;
|
||||
FFPopupShowType showType = (FFPopupShowType)popupService.showType;
|
||||
FFPopupDismissType dismissType = FFPopupDismissType_GrowOut;
|
||||
if (popupService.style == TTPopupStyleActionSheet) {
|
||||
verticalLayout = FFPopupVerticalLayout_Bottom;
|
||||
showType = FFPopupShowType_SlideInFromBottom;
|
||||
dismissType = FFPopupDismissType_SlideOutToBottom;
|
||||
}
|
||||
FFPopup *popup = [FFPopup popupWithContentView:popupService.contentView];
|
||||
popup.showType = showType;
|
||||
popup.dismissType = dismissType;
|
||||
popup.maskType = FFPopupMaskType_Dimmed;
|
||||
popup.dimmedMaskAlpha = popupService.maskBackgroundAlpha;
|
||||
popup.shouldDismissOnBackgroundTouch = popupService.shouldDismissOnBackgroundTouch;
|
||||
|
||||
[popup showWithLayout:FFPopupLayoutMake(horizontalLayout, verticalLayout) duration:0.0];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
// 不管是调用’dismissPopupForView:animated:‘ 还是‘点击蒙层消除’,最终都会走到这里
|
||||
// 适合在此展示队列中下一个弹窗
|
||||
// 通过 _currentPopupService 是否为空可以判断是哪种消除方式
|
||||
popup.didFinishDismissingBlock = ^{
|
||||
__strong typeof(weakSelf) strongSelf = weakSelf;
|
||||
BOOL isDismissOnBackgroundTouch = strongSelf.currentPopupService != nil;
|
||||
if (isDismissOnBackgroundTouch) {
|
||||
// ‘点击蒙层消除’时,在展现下一个弹窗前移除数据源
|
||||
[self removeSourceWhenTouchMaskView];
|
||||
}
|
||||
if (popupService.didFinishDismissHandler) {
|
||||
popupService.didFinishDismissHandler(isDismissOnBackgroundTouch);
|
||||
}
|
||||
// 弹窗消除结束,更新状态
|
||||
strongSelf.showingPopup = NO;
|
||||
// 显示下一个弹窗
|
||||
[strongSelf showPopup];
|
||||
};
|
||||
|
||||
popup.didFinishShowingBlock = ^{
|
||||
// 开始弹窗,更新状态
|
||||
self.showingPopup = YES;
|
||||
if (popupService.didFinishShowingHandler) {
|
||||
popupService.didFinishShowingHandler();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
弹窗将要插入队列的位置
|
||||
@param service 弹窗服务实例
|
||||
@return 队列的位置
|
||||
*/
|
||||
- (NSInteger)insertPositionForPopupService:(id<TTPopupServiceProtocol>)service {
|
||||
__block NSInteger result = NSNotFound;
|
||||
if (service == nil) {
|
||||
return result;
|
||||
}
|
||||
if (_queue.count == 0) {
|
||||
return 0;
|
||||
}
|
||||
// 设置重复弹窗过滤
|
||||
if (service.shouldFilterPopup && service.filterIdentifier.length > 0) {
|
||||
BOOL filterFlag = NO;
|
||||
for (id<TTPopupServiceProtocol> serv in _queue) {
|
||||
if ([serv.filterIdentifier isEqualToString:service.filterIdentifier]) {
|
||||
filterFlag = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (filterFlag) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
[_queue enumerateObjectsUsingBlock:^(id<TTPopupServiceProtocol> _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
// 找到队中比当前弹窗优先级低的位置
|
||||
if (service.priority > model.priority) {
|
||||
result = idx;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
// 如果没有合适的位置,则将新的弹窗放在队尾
|
||||
result = MIN(result, _queue.count);
|
||||
return result;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// TTPopupManagerServiceProtocol.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTPopupServiceProtocol.h"
|
||||
|
||||
@protocol TTPopupManagerServiceProtocol <NSObject>
|
||||
|
||||
/**
|
||||
添加一个弹窗
|
||||
|
||||
@param service 服从弹窗服务的实例
|
||||
*/
|
||||
- (void)addPopupService:(id<TTPopupServiceProtocol>)service;
|
||||
|
||||
/**
|
||||
移除一个弹窗
|
||||
*/
|
||||
- (void)removePopupService;
|
||||
|
||||
@end
|
22
xplan-ios/Base/UI/TTPopup/Service/TTPopupService.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// TTPopupService.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "TTPopupServiceProtocol.h"
|
||||
|
||||
// TTPopupConfig 是 TTPopupService 的别称
|
||||
// 具体信息见 TTPopupService
|
||||
#define TTPopupConfig TTPopupService
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TTPopupService : NSObject<TTPopupServiceProtocol>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
36
xplan-ios/Base/UI/TTPopup/Service/TTPopupService.m
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// TTPopupService.m
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTPopupService.h"
|
||||
|
||||
@implementation TTPopupService
|
||||
|
||||
@synthesize style = _style;
|
||||
@synthesize priority = _priority;
|
||||
@synthesize contentView = _contentView;
|
||||
@synthesize maskBackgroundAlpha = _maskBackgroundAlpha;
|
||||
@synthesize shouldDismissOnBackgroundTouch = _shouldDismissOnBackgroundTouch;
|
||||
@synthesize didFinishDismissHandler = _didFinishDismissHandler;
|
||||
@synthesize didFinishShowingHandler = _didFinishShowingHandler;
|
||||
@synthesize shouldFilterPopup = _shouldFilterPopup;
|
||||
@synthesize filterIdentifier = _filterIdentifier;
|
||||
@synthesize showType = _showType;
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_style = TTPopupStyleAlert;
|
||||
_priority = TTPopupPriorityNormal;
|
||||
_maskBackgroundAlpha = 0.3;
|
||||
_shouldDismissOnBackgroundTouch = YES;
|
||||
_shouldFilterPopup = NO;
|
||||
_showType = TTPopupShowTypeDefault;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
78
xplan-ios/Base/UI/TTPopup/Service/TTPopupServiceProtocol.h
Normal file
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// TTPopupServiceProtocol.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/21.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTPopupConstants.h"
|
||||
|
||||
typedef NS_ENUM(NSUInteger, TTPopupShowType) {
|
||||
TTPopupShowType_FadeIn = 1,
|
||||
TTPopupShowTypeDefault = 8,
|
||||
};
|
||||
|
||||
@class UIView;
|
||||
|
||||
@protocol TTPopupServiceProtocol <NSObject>
|
||||
|
||||
/**
|
||||
弹窗样式,默认:TTPopupStyleAlert
|
||||
*/
|
||||
@property (nonatomic, assign) TTPopupStyle style;
|
||||
|
||||
/**
|
||||
弹窗优先级权重,默认:TTPopupPriorityNormal
|
||||
|
||||
@discussion 权重越高在弹窗队列的优先级越高,即优先弹出;相同权重按先来后到原则
|
||||
*/
|
||||
@property (nonatomic, assign) TTPopupPriority priority;
|
||||
|
||||
/**
|
||||
自定义视图内容,默认:nil
|
||||
|
||||
@discussion 如果未配置,或 contentView 未继承自 UIView 及其子类,将忽略该弹窗
|
||||
*/
|
||||
@property (nonatomic, strong) UIView *contentView;
|
||||
|
||||
/**
|
||||
背景蒙层透明度,默认:0x000000 0.3 alpha
|
||||
|
||||
@discussion 由于第三方原因,暂不支持蒙层颜色修改
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat maskBackgroundAlpha;
|
||||
|
||||
/**
|
||||
点击蒙层是否消除弹窗,默认:YES
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL shouldDismissOnBackgroundTouch;
|
||||
|
||||
/**
|
||||
弹窗消失回调,isDismissOnBackgroundTouch 区分是否点击蒙层触发
|
||||
*/
|
||||
@property (nonatomic, copy) void (^didFinishDismissHandler)(BOOL isDismissOnBackgroundTouch);
|
||||
|
||||
/**
|
||||
弹窗显示成功回调
|
||||
*/
|
||||
@property (nonatomic, copy) void (^didFinishShowingHandler)(void);
|
||||
|
||||
/**
|
||||
重复弹窗过滤,默认:NO
|
||||
|
||||
@discussion 设置过滤时,队列中将不会出现相同过滤标识的弹窗
|
||||
过滤标识通过 #<filterIdentifier> 设置
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL shouldFilterPopup;
|
||||
|
||||
/**
|
||||
过滤标识,默认:nil
|
||||
*/
|
||||
@property (nonatomic, copy) NSString *filterIdentifier;
|
||||
|
||||
/**
|
||||
显示动画类型, 默认是 default
|
||||
*/
|
||||
@property (nonatomic, assign) TTPopupShowType showType;
|
||||
@end
|
126
xplan-ios/Base/UI/TTPopup/TTPopup.h
Normal file
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// TTPopup.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/22.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
// 弹窗工具类
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "TTPopupConstants.h"
|
||||
#import "TTAlertConfig.h"
|
||||
#import "TTActionSheetConfig.h"
|
||||
#import "TTPopupService.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class UIView;
|
||||
|
||||
@interface TTPopup : NSObject
|
||||
|
||||
#pragma mark Alert
|
||||
/**
|
||||
显示 alert 弹窗
|
||||
|
||||
@discussion 显示四个内容:默认标题‘提示’,提示内容,取消按钮,确认按钮
|
||||
|
||||
@param message 提示内容,不能为空(⊙o⊙)哦
|
||||
@param confirmHandler 确认操作
|
||||
@param cancelHandler 取消操作
|
||||
*/
|
||||
+ (void)alertWithMessage:(NSString *)message
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler;
|
||||
|
||||
|
||||
/**
|
||||
显示 alert 弹窗
|
||||
|
||||
@discussion 显示四个内容:默认标题‘提示’,提示内容,取消按钮,确认按钮
|
||||
|
||||
@param config 完善的视图配置,为您变态的需求保驾护航
|
||||
@param isShowBorder 是否显示边框
|
||||
@param confirmHandler 确认操作
|
||||
@param cancelHandler 取消操作
|
||||
*/
|
||||
+ (void)alertWithConfig:(TTAlertConfig *)config
|
||||
showBorder:(BOOL)isShowBorder
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler;
|
||||
|
||||
|
||||
|
||||
+ (void)alertWithMessage:(NSString *)message
|
||||
config:(TTAlertConfig *)config
|
||||
showBorder:(BOOL)isShowBorder
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler;
|
||||
|
||||
/**
|
||||
显示 alert 弹窗
|
||||
@discussion 显示四个内容:标题,提示内容,取消按钮,确认按钮
|
||||
@param config 完善的视图配置,为您变态的需求保驾护航
|
||||
@param cancelHandler 取消操作
|
||||
@param confirmHandler 确认操作
|
||||
*/
|
||||
+ (void)alertWithConfig:(TTAlertConfig *)config
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler;
|
||||
|
||||
#pragma mark Action Sheet
|
||||
/**
|
||||
显示 action sheet 弹窗,自带贴心的取消按钮😊
|
||||
|
||||
@param items 配置列表
|
||||
*/
|
||||
+ (void)actionSheetWithItems:(NSArray<TTActionSheetConfig *> *)items;
|
||||
|
||||
/**
|
||||
显示 action sheet 弹窗
|
||||
|
||||
@param items 配置列表
|
||||
@param showCancelItem 是否显示取消按钮
|
||||
*/
|
||||
+ (void)actionSheetWithItems:(NSArray<TTActionSheetConfig *> *)items
|
||||
showCancelItem:(BOOL)showCancelItem;
|
||||
|
||||
/**
|
||||
显示 action sheet 弹窗
|
||||
|
||||
@param items 配置列表
|
||||
@param cancelHandler 取消按钮回调
|
||||
*/
|
||||
+ (void)actionSheetWithItems:(NSArray<TTActionSheetConfig *> *)items
|
||||
cancelHandler:(TTActionSheetClickAction)cancelHandler;
|
||||
|
||||
#pragma mark Popup
|
||||
/**
|
||||
显示自定义弹窗
|
||||
@param customView 自定义 view
|
||||
@param style 弹窗样式
|
||||
*/
|
||||
+ (void)popupView:(UIView *)customView
|
||||
style:(TTPopupStyle)style;
|
||||
|
||||
/**
|
||||
显示自定义弹窗
|
||||
|
||||
@param config 自定义弹窗配置
|
||||
*/
|
||||
+ (void)popupWithConfig:(TTPopupService *)config;
|
||||
|
||||
#pragma mark Dismiss
|
||||
/**
|
||||
消除当前弹窗
|
||||
*/
|
||||
+ (void)dismiss;
|
||||
|
||||
#pragma mark Query
|
||||
/**
|
||||
当前是否有显示弹窗
|
||||
*/
|
||||
+ (BOOL)hasShowPopup;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
236
xplan-ios/Base/UI/TTPopup/TTPopup.m
Normal file
@@ -0,0 +1,236 @@
|
||||
//
|
||||
// TTPopup.m
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lvjunhang on 2019/5/22.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTPopup.h"
|
||||
#import "TTAlertView.h"
|
||||
#import "TTActionSheetView.h"
|
||||
#import "TTPopupService.h"
|
||||
#import "TTPopupManagerService.h"
|
||||
|
||||
static CGFloat const kActionSheetViewPadding = 15.f;
|
||||
static CGFloat const kActionSheetViewCellHeight = 52.f;
|
||||
static CGFloat const kActionSheetViewCancelViewHeight = 67.f;
|
||||
static CGFloat const kActionSheetViewBottomPadding = 15.f;
|
||||
static CGFloat const kMixHeight = 200.f;
|
||||
static CGFloat const kMaxHeight = 450.f;
|
||||
|
||||
@implementation TTPopup
|
||||
|
||||
#pragma mark - Public Methods
|
||||
#pragma mark Alert
|
||||
+ (void)alertWithMessage:(NSString *)message
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler {
|
||||
|
||||
[self alertWithMessage:message
|
||||
config:nil
|
||||
cancelHandler:cancelHandler
|
||||
confirmHandler:confirmHandler];
|
||||
}
|
||||
|
||||
+ (void)alertWithConfig:(TTAlertConfig *)config
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler {
|
||||
|
||||
[self alertWithMessage:nil
|
||||
config:config
|
||||
cancelHandler:cancelHandler
|
||||
confirmHandler:confirmHandler];
|
||||
}
|
||||
|
||||
+ (void)alertWithMessage:(NSString *)message
|
||||
config:(TTAlertConfig *)config
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler {
|
||||
|
||||
if (!config) {
|
||||
config = [[TTAlertConfig alloc] init];
|
||||
config.message = message;
|
||||
}
|
||||
if (config.message.length <= 0) {
|
||||
NSAssert(NO, @" message can not be nil, 弹窗文案不可以为空");
|
||||
return;
|
||||
}
|
||||
CGFloat width = [UIScreen mainScreen].bounds.size.width - 40 * 2;
|
||||
CGFloat height = ([self messageSize:config.message width:width].height + 160);
|
||||
// 最小 200, 最大 450
|
||||
if (height < kMixHeight) {
|
||||
height = kMixHeight;
|
||||
} else if (height > kMaxHeight) {
|
||||
height = kMaxHeight;
|
||||
}
|
||||
TTAlertView *contentView = [[TTAlertView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
|
||||
contentView.config = config;
|
||||
contentView.isConfigBoard = NO;
|
||||
contentView.cancelAction = cancelHandler;
|
||||
contentView.confirmAction = confirmHandler;
|
||||
if (!contentView.config.disableAutoDismissWhenClickButton) {
|
||||
// 设置弹窗按钮自动消除
|
||||
contentView.dismissAction = ^{
|
||||
[TTPopup dismiss];
|
||||
};
|
||||
}
|
||||
[self popupView:contentView style:TTPopupStyleAlert config:config];
|
||||
}
|
||||
|
||||
+ (void)alertWithConfig:(TTAlertConfig *)config
|
||||
showBorder:(BOOL)isShowBorder
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler {
|
||||
[self alertWithMessage:nil
|
||||
config:config
|
||||
showBorder:isShowBorder
|
||||
cancelHandler:cancelHandler
|
||||
confirmHandler:confirmHandler];
|
||||
}
|
||||
|
||||
+ (void)alertWithMessage:(NSString *)message
|
||||
config:(TTAlertConfig *)config
|
||||
showBorder:(BOOL)isShowBorder
|
||||
cancelHandler:(TTPopupCompletionHandler)cancelHandler
|
||||
confirmHandler:(TTPopupCompletionHandler)confirmHandler {
|
||||
|
||||
if (!config) {
|
||||
config = [[TTAlertConfig alloc] init];
|
||||
config.message = message;
|
||||
}
|
||||
|
||||
if (config.message.length <= 0) {
|
||||
NSAssert(NO, @" message can not be nil, 弹窗文案不可以为空");
|
||||
return;
|
||||
}
|
||||
|
||||
CGFloat width = [UIScreen mainScreen].bounds.size.width - 40 * 2;
|
||||
CGFloat height = ([self messageSize:config.message width:width].height + 160);
|
||||
|
||||
// 最小 200, 最大 450
|
||||
if (height < kMixHeight) {
|
||||
height = kMixHeight;
|
||||
} else if (height > kMaxHeight) {
|
||||
height = kMaxHeight;
|
||||
}
|
||||
|
||||
TTAlertView *contentView = [[TTAlertView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
|
||||
contentView.config = config;
|
||||
contentView.cancelAction = cancelHandler;
|
||||
contentView.confirmAction = confirmHandler;
|
||||
contentView.isConfigBoard = isShowBorder;
|
||||
|
||||
if (!contentView.config.disableAutoDismissWhenClickButton) {
|
||||
// 设置弹窗按钮自动消除
|
||||
contentView.dismissAction = ^{
|
||||
[TTPopup dismiss];
|
||||
};
|
||||
}
|
||||
|
||||
[self popupView:contentView style:TTPopupStyleAlert config:config];
|
||||
}
|
||||
|
||||
#pragma mark Action Sheet
|
||||
+ (void)actionSheetWithItems:(NSArray<TTActionSheetConfig *> *)items {
|
||||
|
||||
[TTPopup actionSheetWithItems:items showCancelItem:YES cancelHandler:nil];
|
||||
}
|
||||
|
||||
+ (void)actionSheetWithItems:(NSArray<TTActionSheetConfig *> *)items
|
||||
showCancelItem:(BOOL)showCancelItem {
|
||||
|
||||
[TTPopup actionSheetWithItems:items showCancelItem:showCancelItem cancelHandler:nil];
|
||||
}
|
||||
|
||||
+ (void)actionSheetWithItems:(NSArray<TTActionSheetConfig *> *)items cancelHandler:(TTActionSheetClickAction)cancelHandler {
|
||||
|
||||
[TTPopup actionSheetWithItems:items showCancelItem:YES cancelHandler:cancelHandler];
|
||||
}
|
||||
|
||||
+ (void)actionSheetWithItems:(NSArray<TTActionSheetConfig *> *)items
|
||||
showCancelItem:(BOOL)showCancelItem
|
||||
cancelHandler:(TTActionSheetClickAction)cancelHandler {
|
||||
|
||||
CGFloat width = [UIScreen mainScreen].bounds.size.width - kActionSheetViewPadding * 2;
|
||||
CGFloat height = kActionSheetViewCellHeight * items.count + kActionSheetViewBottomPadding;
|
||||
|
||||
// 如果需要显示取消按钮则增加响应的高度
|
||||
if (showCancelItem) {
|
||||
// 按钮的高度和间距
|
||||
height += kActionSheetViewCancelViewHeight;
|
||||
}
|
||||
|
||||
if (@available(iOS 11.0, *)) {
|
||||
// 如果是 iPhone X 系列(刘海屏幕系列) 底部则需要添加 34 的高度
|
||||
height += [UIApplication sharedApplication].keyWindow.safeAreaInsets.bottom;
|
||||
}
|
||||
|
||||
CGRect rect = CGRectMake(0, 0, width, height);
|
||||
|
||||
TTActionSheetView *sheetView = [[TTActionSheetView alloc] initWithFrame:rect
|
||||
needCancel:showCancelItem
|
||||
items:items];
|
||||
sheetView.cancelAction = cancelHandler;
|
||||
|
||||
// 设置弹窗按钮自动消除
|
||||
sheetView.dismissAction = ^{
|
||||
[TTPopup dismiss];
|
||||
};
|
||||
|
||||
[self popupView:sheetView style:TTPopupStyleActionSheet];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Popup
|
||||
+ (void)popupView:(UIView *)customView
|
||||
style:(TTPopupStyle)style {
|
||||
|
||||
TTPopupService *service = [[TTPopupService alloc] init];
|
||||
service.style = style;
|
||||
service.contentView = customView;
|
||||
|
||||
[self popupWithConfig:service];
|
||||
}
|
||||
|
||||
+ (void)popupView:(UIView *)customView
|
||||
style:(TTPopupStyle)style
|
||||
config:(TTAlertConfig *)config {
|
||||
|
||||
TTPopupService *service = [[TTPopupService alloc] init];
|
||||
service.style = style;
|
||||
service.contentView = customView;
|
||||
service.shouldDismissOnBackgroundTouch = config.shouldDismissOnBackgroundTouch;
|
||||
service.maskBackgroundAlpha = config.maskBackgroundAlpha;
|
||||
[self popupWithConfig:service];
|
||||
}
|
||||
|
||||
|
||||
+ (void)popupWithConfig:(TTPopupService *)config {
|
||||
if (![config.contentView isKindOfClass:UIView.class]) {
|
||||
NSAssert(NO, @"TTPopup customView should inherit from UIView.");
|
||||
return;
|
||||
}
|
||||
[[TTPopupManagerService sharedInstance] addPopupService:config];
|
||||
}
|
||||
|
||||
#pragma mark Dismiss
|
||||
+ (void)dismiss {
|
||||
[[TTPopupManagerService sharedInstance] removePopupService];
|
||||
}
|
||||
|
||||
#pragma mark Query
|
||||
/**
|
||||
当前是否有显示弹窗
|
||||
*/
|
||||
+ (BOOL)hasShowPopup {
|
||||
return [TTPopupManagerService sharedInstance].currentPopupService != nil;
|
||||
}
|
||||
|
||||
#pragma mark - Privite
|
||||
+ (CGSize)messageSize:(NSString *)text width:(CGFloat)width {
|
||||
CGRect stringRect = [text boundingRectWithSize:CGSizeMake(width - 2 * 20, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15.f]} context:nil];
|
||||
return stringRect.size;
|
||||
}
|
||||
|
||||
@end
|
26
xplan-ios/Base/UI/TTPopup/View/TTActionSheetView.h
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// TTActionSheetView.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/22.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TTPopupConstants.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class TTActionSheetConfig;
|
||||
|
||||
@interface TTActionSheetView : UIView
|
||||
|
||||
@property (nonatomic, copy) TTPopupCompletionHandler cancelAction;
|
||||
@property (nonatomic, copy) TTPopupCompletionHandler dismissAction;
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
needCancel:(BOOL)needCancel
|
||||
items:(NSArray<TTActionSheetConfig *> *)items;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
134
xplan-ios/Base/UI/TTPopup/View/TTActionSheetView.m
Normal file
@@ -0,0 +1,134 @@
|
||||
//
|
||||
// TTActionSheetView.m
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/22.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTActionSheetView.h"
|
||||
#import "TTActionSheetConfig.h"
|
||||
#import "ThemeColor.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
static CGFloat const kSheetViewCellHeight = 51.f;
|
||||
static CGFloat const kSheetViewCornerRadius = 14.f;
|
||||
static NSString *const kSheetViewCellConst = @"kSheetViewCellConst";
|
||||
|
||||
@interface TTActionSheetView ()<UITableViewDelegate, UITableViewDataSource>
|
||||
|
||||
/** sheetView 载体 */
|
||||
@property (nonatomic, strong) UITableView *tableView;
|
||||
/** 数据源 */
|
||||
@property (nonatomic, strong) NSArray<TTActionSheetConfig *> *items;
|
||||
/** 是否需要显示取消按钮 */
|
||||
@property (nonatomic, assign) BOOL needCancel;
|
||||
/** 取消按钮 */
|
||||
@property (nonatomic, strong) UIButton *cancelButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TTActionSheetView
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark lifeCycle
|
||||
- (instancetype)initWithFrame:(CGRect)frame needCancel:(BOOL)needCancel items:(NSArray<TTActionSheetConfig *> *)items {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
_items = items;
|
||||
_needCancel = needCancel;
|
||||
[self initViews];
|
||||
[self initConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initViews {
|
||||
[self addSubview:self.tableView];
|
||||
[self addSubview:self.cancelButton];
|
||||
}
|
||||
|
||||
- (void)initConstraints {
|
||||
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self);
|
||||
make.height.mas_equalTo(self.items.count * kSheetViewCellHeight);
|
||||
}];
|
||||
|
||||
if (_needCancel) {
|
||||
// 显示 cancel view
|
||||
self.cancelButton.hidden = NO;
|
||||
[self.cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self);
|
||||
make.height.mas_equalTo(kSheetViewCellHeight);
|
||||
make.top.mas_equalTo(self.tableView.mas_bottom).offset(15);
|
||||
}];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 1;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.items.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kSheetViewCellConst];
|
||||
cell.backgroundColor = UIColor.clearColor;
|
||||
cell.textLabel.textAlignment = NSTextAlignmentCenter;
|
||||
cell.textLabel.text = _items[indexPath.row].title;
|
||||
cell.textLabel.textColor = _items[indexPath.row].titleColor;
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
|
||||
// 配置中的事件处理
|
||||
TTActionSheetConfig *config = _items[indexPath.row];
|
||||
!config.clickAction ?: config.clickAction();
|
||||
|
||||
!_dismissAction ?: _dismissAction();
|
||||
}
|
||||
|
||||
- (void)onClickCancelButtonAction:(UIButton *)cancelButton {
|
||||
!_cancelAction ?: _cancelAction();
|
||||
!_dismissAction ?: _dismissAction();
|
||||
}
|
||||
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.separatorColor = [ThemeColor dividerColor];
|
||||
_tableView.rowHeight = kSheetViewCellHeight;
|
||||
_tableView.tableFooterView = [[UIView alloc] init];
|
||||
_tableView.backgroundColor = [UIColor whiteColor];
|
||||
_tableView.layer.cornerRadius = kSheetViewCornerRadius;
|
||||
_tableView.layer.masksToBounds = YES;
|
||||
_tableView.bounces = NO;
|
||||
[_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kSheetViewCellConst];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (UIButton *)cancelButton {
|
||||
if (!_cancelButton) {
|
||||
_cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_cancelButton setTitle:@"取消" forState:UIControlStateNormal];
|
||||
[_cancelButton setBackgroundColor:UIColor.whiteColor];
|
||||
[_cancelButton setTitleColor:[ThemeColor alertMessageColor] forState:UIControlStateNormal];
|
||||
[_cancelButton.titleLabel setFont:[UIFont systemFontOfSize:16]];
|
||||
_cancelButton.layer.cornerRadius = kSheetViewCornerRadius;
|
||||
_cancelButton.layer.masksToBounds = YES;
|
||||
[_cancelButton addTarget:self action:@selector(onClickCancelButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_cancelButton.hidden = YES;
|
||||
}
|
||||
return _cancelButton;
|
||||
}
|
||||
|
||||
@end
|
25
xplan-ios/Base/UI/TTPopup/View/TTAlertView.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// TTAlertView.h
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/20.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TTPopupConstants.h"
|
||||
|
||||
@class TTAlertConfig;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TTAlertView : UIView
|
||||
@property (nonatomic, strong) TTAlertConfig *config;// 配置
|
||||
@property (nonatomic, assign) BOOL isConfigBoard;// 是否配置边框
|
||||
@property (nonatomic, copy) TTPopupCompletionHandler cancelAction;
|
||||
@property (nonatomic, copy) TTPopupCompletionHandler confirmAction;
|
||||
@property (nonatomic, copy) TTPopupCompletionHandler dismissAction;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
230
xplan-ios/Base/UI/TTPopup/View/TTAlertView.m
Normal file
@@ -0,0 +1,230 @@
|
||||
//
|
||||
// TTAlertView.m
|
||||
// XC_TTChatViewKit
|
||||
//
|
||||
// Created by lee on 2019/5/20.
|
||||
// Copyright © 2019 YiZhuan. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TTAlertView.h"
|
||||
#import "TTAlertConfig.h"
|
||||
#import "ThemeColor.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
static CGFloat const kMargin = 25.f;
|
||||
static CGFloat const kPadding = 20.f;
|
||||
static CGFloat const kBtnHeight = 38.f;
|
||||
|
||||
@interface TTAlertView ()
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel; // 标题
|
||||
@property (nonatomic, strong) UILabel *messageLabel; // 内容
|
||||
@property (nonatomic, strong) UIButton *cancelButton; // 取消按钮
|
||||
@property (nonatomic, strong) UIButton *confirmButton; // 确认按钮
|
||||
|
||||
@end
|
||||
|
||||
@implementation TTAlertView
|
||||
|
||||
#pragma mark - lifeCyle
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initViews];
|
||||
[self initConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initViews {
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.messageLabel];
|
||||
[self addSubview:self.cancelButton];
|
||||
[self addSubview:self.confirmButton];
|
||||
}
|
||||
|
||||
- (void)initConstraints {
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.mas_equalTo(kPadding);
|
||||
make.left.right.mas_equalTo(self).inset(kPadding);
|
||||
}];
|
||||
|
||||
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(kMargin);
|
||||
make.left.right.mas_equalTo(self).inset(kPadding);
|
||||
}];
|
||||
|
||||
[self.cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kBtnHeight);
|
||||
make.right.mas_equalTo(self.mas_centerX).offset(-8);
|
||||
make.left.mas_equalTo(kPadding);
|
||||
make.bottom.mas_equalTo(-kPadding);
|
||||
}];
|
||||
|
||||
[self.confirmButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(kBtnHeight);
|
||||
make.left.mas_equalTo(self.mas_centerX).offset(8);
|
||||
make.right.mas_equalTo(-kPadding);
|
||||
make.bottom.mas_equalTo(-kPadding);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Button Events
|
||||
- (void)onClickConfirmButtonAction:(UIButton *)confirmButton {
|
||||
!_confirmAction ?: _confirmAction();
|
||||
!_dismissAction ?: _dismissAction();
|
||||
}
|
||||
|
||||
- (void)onClickCancelButtonAction:(UIButton *)cancelButton {
|
||||
!_cancelAction ?: _cancelAction();
|
||||
!_dismissAction ?: _dismissAction();
|
||||
}
|
||||
|
||||
#pragma mark - private method
|
||||
/**
|
||||
设置 messageLabel 需要显示的富文本效果
|
||||
@param config 弹窗配置
|
||||
@return 富文本内容
|
||||
*/
|
||||
- (NSMutableAttributedString *)messageAttributeString:(TTAlertConfig *)config {
|
||||
NSMutableAttributedString *attString = [[NSMutableAttributedString alloc] initWithString:config.message];
|
||||
if (config.messageLineSpacing > 0) { // 行间距
|
||||
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
paragraphStyle.lineSpacing = config.messageLineSpacing;
|
||||
paragraphStyle.alignment = self.messageLabel.textAlignment;
|
||||
[attString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, config.message.length)];
|
||||
}
|
||||
|
||||
// 富文本显示效果
|
||||
[config.messageAttributedConfig enumerateObjectsUsingBlock:^(TTAlertMessageAttributedConfig * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
// 遍历数组,添加展示富文本效果
|
||||
if ([obj isKindOfClass:[TTAlertMessageAttributedConfig class]]) {
|
||||
if (obj.text && obj.text.length > 0) {
|
||||
NSRange range = [config.message rangeOfString:obj.text];
|
||||
// 如果外部指定了 range 。就不用查找出的 range
|
||||
if (obj.range.length != 0) {
|
||||
if (obj.range.location + obj.range.length > config.message.length) {
|
||||
NSAssert(NO, @"obj.range out of bounds");
|
||||
return;
|
||||
}
|
||||
range = obj.range;
|
||||
}
|
||||
if (obj.font) { // 字体
|
||||
[attString addAttribute:NSFontAttributeName value:obj.font range:range];
|
||||
}
|
||||
if (obj.color) { // 颜色
|
||||
[attString addAttribute:NSForegroundColorAttributeName value:obj.color range:range];
|
||||
}
|
||||
}
|
||||
}
|
||||
}];
|
||||
return attString;
|
||||
}
|
||||
|
||||
#pragma mark - getter && setter
|
||||
|
||||
- (void)setConfig:(TTAlertConfig *)config {
|
||||
_config = config;
|
||||
// cornerRadius
|
||||
if (config.cornerRadius > 0) {
|
||||
self.layer.cornerRadius = config.cornerRadius;
|
||||
self.layer.masksToBounds = YES;
|
||||
}
|
||||
//背景
|
||||
self.backgroundColor = config.backgroundColor;
|
||||
// title
|
||||
_titleLabel.text = config.title;
|
||||
_titleLabel.textColor = config.titleColor;
|
||||
_titleLabel.font = config.titleFont;
|
||||
|
||||
// cancel button
|
||||
[_cancelButton setTitle:config.cancelButtonConfig.title forState:UIControlStateNormal];
|
||||
[_cancelButton setTitleColor:config.cancelButtonConfig.titleColor forState:UIControlStateNormal];
|
||||
[_cancelButton.titleLabel setFont:config.cancelButtonConfig.font];
|
||||
[_cancelButton setBackgroundColor:config.cancelButtonConfig.backgroundColor];
|
||||
[_cancelButton setBackgroundImage:config.cancelButtonConfig.backgroundImage forState:UIControlStateNormal];
|
||||
if (config.cancelButtonConfig.cornerRadius > 0) {
|
||||
_cancelButton.layer.cornerRadius = config.cancelButtonConfig.cornerRadius;
|
||||
_cancelButton.layer.masksToBounds = YES;
|
||||
}
|
||||
|
||||
// confirm button
|
||||
[_confirmButton setTitle:config.confirmButtonConfig.title forState:UIControlStateNormal];
|
||||
[_confirmButton setTitleColor:config.confirmButtonConfig.titleColor forState:UIControlStateNormal];
|
||||
[_confirmButton.titleLabel setFont:config.confirmButtonConfig.font];
|
||||
[_confirmButton setBackgroundColor:config.confirmButtonConfig.backgroundColor];
|
||||
[_confirmButton setBackgroundImage:config.confirmButtonConfig.backgroundImage forState:UIControlStateNormal];
|
||||
if (config.confirmButtonConfig.cornerRadius > 0) {
|
||||
_confirmButton.layer.cornerRadius = config.confirmButtonConfig.cornerRadius;
|
||||
_confirmButton.layer.masksToBounds = YES;
|
||||
}
|
||||
|
||||
// message
|
||||
_messageLabel.font = config.messageFont;
|
||||
_messageLabel.textColor = config.messageColor;
|
||||
|
||||
if (config.messageAttributedConfig.count > 0) {
|
||||
_messageLabel.attributedText = [self messageAttributeString:config];
|
||||
} else {
|
||||
_messageLabel.text = config.message;
|
||||
}
|
||||
|
||||
_cancelButton.layer.borderColor = [ThemeColor dividerColor].CGColor;
|
||||
_cancelButton.layer.borderWidth = 2.f;
|
||||
_confirmButton.layer.borderColor = [ThemeColor dividerColor].CGColor;
|
||||
_confirmButton.layer.borderWidth = 2.f;
|
||||
}
|
||||
|
||||
- (void)setIsConfigBoard:(BOOL)isConfigBoard {
|
||||
_isConfigBoard = isConfigBoard;
|
||||
if (isConfigBoard) {
|
||||
//需要边框
|
||||
_cancelButton.layer.borderColor = [ThemeColor dividerColor].CGColor;
|
||||
_cancelButton.layer.borderWidth = 2.f;
|
||||
_confirmButton.layer.borderColor = [ThemeColor dividerColor].CGColor;
|
||||
_confirmButton.layer.borderWidth = 2.f;
|
||||
}else {
|
||||
//不需要边框
|
||||
_cancelButton.layer.borderColor = [ThemeColor dividerColor].CGColor;
|
||||
_cancelButton.layer.borderWidth = 0;
|
||||
_confirmButton.layer.borderColor = [ThemeColor dividerColor].CGColor;
|
||||
_confirmButton.layer.borderWidth = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _titleLabel ;
|
||||
}
|
||||
|
||||
- (UILabel *)messageLabel {
|
||||
if (!_messageLabel) {
|
||||
_messageLabel = [[UILabel alloc] init];
|
||||
_messageLabel.numberOfLines = 0;
|
||||
_messageLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _messageLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)cancelButton {
|
||||
if (!_cancelButton) {
|
||||
_cancelButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_cancelButton addTarget:self action:@selector(onClickCancelButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _cancelButton;
|
||||
}
|
||||
|
||||
- (UIButton *)confirmButton {
|
||||
if (!_confirmButton) {
|
||||
_confirmButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_confirmButton addTarget:self action:@selector(onClickConfirmButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _confirmButton;
|
||||
}
|
||||
|
||||
@end
|
@@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@interface ThemeColor : NSObject
|
||||
/// 主题色 #248CFE
|
||||
+ (UIColor *)appMainColor;
|
||||
|
||||
/* ------页面相关颜色 START------ */
|
||||
/// view的背景色 #1C1B22
|
||||
+ (UIColor *)appBackgroundColor;
|
||||
/// cell的背景色 #2A2A39
|
||||
@@ -24,6 +26,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (UIColor *)textThirdColor;
|
||||
///分割线的颜色 #201F27
|
||||
+ (UIColor *)dividerColor;
|
||||
/* ------页面相关颜色 END------ */
|
||||
|
||||
/* ------Button 相关颜色 START------ */
|
||||
/// button 可用 渐变色的开始 #218EFF
|
||||
+ (UIColor *)confirmButtonGradientStartColor;
|
||||
/// button 可用 渐变色的开始 #7727E4
|
||||
@@ -40,6 +45,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (UIColor *)disableButtonColor;
|
||||
/// 按钮不可点击文字颜色 #4F516A
|
||||
+ (UIColor *)disableButtonTextColor;
|
||||
/* ------Button 相关颜色 END------ */
|
||||
|
||||
/* ------弹窗相关颜色 START------ */
|
||||
+ (UIColor *)alertBackgroundColor;
|
||||
+ (UIColor *)alertTitleColor;
|
||||
+ (UIColor *)alertMessageColor;
|
||||
/* ------弹窗相关颜色 END------ */
|
||||
|
||||
///tabbar 没有点击的时候颜色555574
|
||||
+ (UIColor *)tabbarNormalColor;
|
||||
///重点标注颜色 0xf944a1
|
||||
|
@@ -14,6 +14,8 @@
|
||||
+ (UIColor *)appMainColor {
|
||||
return UIColorFromRGB(0x248CFE);
|
||||
}
|
||||
|
||||
/* ------页面相关颜色 START------ */
|
||||
/// view的背景色 #1C1B22
|
||||
+ (UIColor *)appBackgroundColor {
|
||||
return UIColorFromRGB(0x1C1B22);
|
||||
@@ -24,20 +26,23 @@
|
||||
}
|
||||
///正文颜色 #FFFFFF
|
||||
+ (UIColor *)mainTextColor {
|
||||
return UIColorFromRGB(0xffffff);
|
||||
return UIColorFromRGB(0xFFFFFF);
|
||||
}
|
||||
/// 二级文字颜色 #C6C6E9
|
||||
+ (UIColor *)secondTextColor {
|
||||
return UIColorFromRGB(0xC6C6E9);
|
||||
}
|
||||
///三级文字的颜色 #999999
|
||||
///三级文字的颜色 #4F516A
|
||||
+ (UIColor *)textThirdColor {
|
||||
return UIColorFromRGB(0x999999);
|
||||
return UIColorFromRGB(0x4F516A);
|
||||
}
|
||||
///分割线的颜色 #201F27
|
||||
+ (UIColor *)dividerColor {
|
||||
return UIColorFromRGB(0x201F27);
|
||||
}
|
||||
/* ------页面相关颜色 END------ */
|
||||
|
||||
/* ------Button 相关颜色 START------ */
|
||||
/// button 可用 渐变色的开始 #218EFF
|
||||
+ (UIColor *)confirmButtonGradientStartColor {
|
||||
return UIColorFromRGB(0x218EFF);
|
||||
@@ -70,6 +75,20 @@
|
||||
+ (UIColor *)disableButtonTextColor {
|
||||
return UIColorFromRGB(0x4F516A);
|
||||
}
|
||||
/* ------Button 相关颜色 END------ */
|
||||
|
||||
/* ------弹窗相关颜色 START------ */
|
||||
+ (UIColor *)alertBackgroundColor {
|
||||
return UIColorFromRGB(0xFFFFFF);
|
||||
}
|
||||
+ (UIColor *)alertTitleColor {
|
||||
return UIColorFromRGB(0x333333);
|
||||
}
|
||||
+ (UIColor *)alertMessageColor {
|
||||
return UIColorFromRGB(0x333333);
|
||||
}
|
||||
/* ------弹窗相关颜色 END------ */
|
||||
|
||||
///tabbar 没有点击的时候颜色555574
|
||||
+ (UIColor *)tabbarNormalColor {
|
||||
return UIColorFromRGB(0x555574);
|
||||
|
@@ -8,6 +8,9 @@
|
||||
#import "XPMineSettingViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <SDWebImage/SDWebImageManager.h>
|
||||
#import "SDWebImageManager.h"
|
||||
#import <ReactiveObjC/ReactiveObjC.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
@@ -17,6 +20,8 @@
|
||||
#import "UserInfoModel.h"
|
||||
///View
|
||||
#import "XPMineSettingTableViewCell.h"
|
||||
#import "TTAlertConfig.h"
|
||||
#import "TTPopup.h"
|
||||
///P
|
||||
#import "XPMineSettingPresent.h"
|
||||
#import "XPMineSettingProtocol.h"
|
||||
@@ -129,7 +134,20 @@
|
||||
break;
|
||||
case XPMineSettingItemType_Clear_Memory:
|
||||
{
|
||||
#warning to do 清理缓存
|
||||
TTAlertConfig *config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"清除缓存";
|
||||
config.message = @"要清除缓存吗?";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes];
|
||||
NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
|
||||
@weakify(self);
|
||||
[[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
|
||||
@strongify(self);
|
||||
[self showSuccessToast:@"清除缓存完成"];
|
||||
}];
|
||||
[[SDWebImageManager sharedManager].imageCache clearWithCacheType:SDImageCacheTypeAll completion:nil];
|
||||
} cancelHandler:^{
|
||||
}];
|
||||
}
|
||||
break;
|
||||
case XPMineSettingItemType_About_Us:
|
||||
|
@@ -11,6 +11,9 @@
|
||||
#import "ApiHost.h"
|
||||
#import "YYUtility.h"
|
||||
#import "HttpRequestHelper.h"
|
||||
#import "XCShareView.h"
|
||||
#import "TTPopup.h"
|
||||
#import "XPMacro.h"
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJExtension/MJExtension.h>
|
||||
#import <RPSDK/RPSDK.h>
|
||||
@@ -44,7 +47,7 @@
|
||||
|
||||
@end
|
||||
|
||||
@interface XPWebViewController () <WKNavigationDelegate, WKScriptMessageHandler>
|
||||
@interface XPWebViewController () <WKNavigationDelegate, WKScriptMessageHandler, XCShareViewDelegate>
|
||||
|
||||
@property (strong, nonatomic) WKWebView *webview;
|
||||
@property (strong, nonatomic) UIProgressView *progressView;
|
||||
@@ -85,10 +88,13 @@ NSString * const kJSOpenFaceLiveness = @"openFaceLiveness";
|
||||
[self.view addSubview:self.progressView];
|
||||
}
|
||||
|
||||
|
||||
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
|
||||
[self.webview evaluateJavaScript:@"document.location.href" completionHandler:^(id _Nullable response, NSError * _Nullable error) {
|
||||
NSLog(@"%@", response);
|
||||
NSString *currentUrl = [NSString stringWithFormat:@"%@", response];
|
||||
if (currentUrl != nil && [currentUrl containsString:API_HOST_URL]) {
|
||||
if ([message.name isEqualToString:kJSOpenSharePage]) {
|
||||
[self showSuccessToast:@"打开分享面板,尚未实现"];
|
||||
[self showSharePanel];
|
||||
} else if ([message.name isEqualToString:kJSGetUid]) {
|
||||
NSString *uid = [[AccountInfoStorage instance] getUid];
|
||||
NSString *js = [NSString stringWithFormat:@"getMessage(\"uid\",%@)", uid];
|
||||
@@ -140,6 +146,8 @@ NSString * const kJSOpenFaceLiveness = @"openFaceLiveness";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setUrl:(NSString *)urlString{
|
||||
_url = urlString;
|
||||
@@ -177,6 +185,50 @@ NSString * const kJSOpenFaceLiveness = @"openFaceLiveness";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showSharePanel {
|
||||
XCShareItem *cycle = [[XCShareItem alloc]init];
|
||||
cycle.title = @"朋友圈";
|
||||
cycle.imageName = @"share_wxcircle";
|
||||
cycle.disableImageName = @"share_wxcircle_disable";
|
||||
cycle.disable = NO;
|
||||
cycle.itemTag = XCShareItemTagMoments;
|
||||
|
||||
XCShareItem *wfriend = [[XCShareItem alloc]init];
|
||||
wfriend.title = @"微信好友";
|
||||
wfriend.imageName = @"share_wx";
|
||||
wfriend.disableImageName = @"share_wx_disable";
|
||||
wfriend.disable = NO;
|
||||
wfriend.itemTag = XCShareItemTagWeChat;
|
||||
|
||||
XCShareItem *zone = [[XCShareItem alloc]init];
|
||||
zone.title = @"QQ空间";
|
||||
zone.imageName = @"share_qqzone";
|
||||
zone.disableImageName = @"share_qqzone_disable";
|
||||
zone.disable = NO;
|
||||
zone.itemTag = XCShareItemTagQQZone;
|
||||
|
||||
XCShareItem *qfriend = [[XCShareItem alloc]init];
|
||||
qfriend.title = @"QQ好友";
|
||||
qfriend.imageName = @"share_qq";
|
||||
qfriend.disableImageName = @"share_qq_disable";
|
||||
qfriend.disable = NO;
|
||||
qfriend.itemTag = XCShareItemTagQQ;
|
||||
|
||||
CGFloat margin = 9;
|
||||
CGSize itemSize = CGSizeMake((KScreenWidth-2*margin)/4, 111);
|
||||
XCShareView *shareView = [[XCShareView alloc]initWithItemSize:itemSize items:@[cycle,wfriend,zone,qfriend] margin:margin];
|
||||
shareView.delegate = self;
|
||||
[TTPopup popupView:shareView style:TTPopupStyleActionSheet];
|
||||
}
|
||||
|
||||
- (void)shareView:(XCShareView *)shareView didSelected:(XCShareItemTag)itemTag {
|
||||
|
||||
}
|
||||
|
||||
- (void)shareViewDidClickCancle:(XCShareView *)shareView {
|
||||
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
|
||||
if ([keyPath isEqualToString:@"estimatedProgress"]) {
|
||||
self.progressView.progress = self.webview.estimatedProgress;
|
||||
|