Commit 3748102683023438733df8b0ed6a4f9430ddd38f
1 parent
ffa6d1fa
弹窗创建完成
Showing
10 changed files
with
170 additions
and
0 deletions
CNLiveCServiceModule.podspec
| @@ -45,6 +45,7 @@ TODO: Add long description of the pod here. | @@ -45,6 +45,7 @@ TODO: Add long description of the pod here. | ||
| 45 | s.dependency 'CNLiveNewTripartiteManagement/MJRefresh' | 45 | s.dependency 'CNLiveNewTripartiteManagement/MJRefresh' |
| 46 | s.dependency 'CNLiveNewTripartiteManagement/SDCycleScrollView' | 46 | s.dependency 'CNLiveNewTripartiteManagement/SDCycleScrollView' |
| 47 | s.dependency 'CNLiveNewTripartiteManagement/QMUIKit' | 47 | s.dependency 'CNLiveNewTripartiteManagement/QMUIKit' |
| 48 | + s.dependency 'CNLiveNewTripartiteManagement/YYCategories' | ||
| 48 | s.dependency 'CNLiveCommonCategory' | 49 | s.dependency 'CNLiveCommonCategory' |
| 49 | s.dependency 'CNLiveBaseKit' | 50 | s.dependency 'CNLiveBaseKit' |
| 50 | s.dependency 'CNLiveBusinessBaseModule' | 51 | s.dependency 'CNLiveBusinessBaseModule' |
CNLiveCServiceModule/Assets/CNServiceBundle.bundle/tips_no@2x.png
0 → 100644
973 Bytes
CNLiveCServiceModule/Assets/CNServiceBundle.bundle/tips_no@3x.png
0 → 100644
1.49 KB
CNLiveCServiceModule/Assets/CNServiceBundle.bundle/tips_select@2x.png
0 → 100644
1.26 KB
CNLiveCServiceModule/Assets/CNServiceBundle.bundle/tips_select@3x.png
0 → 100644
2.01 KB
CNLiveCServiceModule/Classes/Manager/CNLiveCServiceManagerBridge.m
| @@ -8,6 +8,9 @@ | @@ -8,6 +8,9 @@ | ||
| 8 | #import "CNLiveCServiceManagerBridge.h" | 8 | #import "CNLiveCServiceManagerBridge.h" |
| 9 | #import "CNLiveServicePresent.h" | 9 | #import "CNLiveServicePresent.h" |
| 10 | #import "CNLiveServiceVC.h" | 10 | #import "CNLiveServiceVC.h" |
| 11 | +#import "CNLiveAlertTipView.h" | ||
| 12 | + | ||
| 13 | +static NSString *NeverShowTip = @"NeverShowTip"; | ||
| 11 | 14 | ||
| 12 | @implementation CNLiveCServiceManagerBridge | 15 | @implementation CNLiveCServiceManagerBridge |
| 13 | + (instancetype)shareManager{ | 16 | + (instancetype)shareManager{ |
CNLiveCServiceModule/Classes/Manager/CNLiveCServicePCH.h
| @@ -23,5 +23,6 @@ | @@ -23,5 +23,6 @@ | ||
| 23 | #import <SDCycleScrollView/SDCycleScrollView.h> | 23 | #import <SDCycleScrollView/SDCycleScrollView.h> |
| 24 | #import <QMUIKit/QMUIKit.h> | 24 | #import <QMUIKit/QMUIKit.h> |
| 25 | #import "CNLiveCServiceManagerBridge.h" | 25 | #import "CNLiveCServiceManagerBridge.h" |
| 26 | +#import <YYCategories/YYCategories.h> | ||
| 26 | 27 | ||
| 27 | #endif /* CNLiveCServicePCH_h */ | 28 | #endif /* CNLiveCServicePCH_h */ |
CNLiveCServiceModule/Classes/View/CNLiveAlertTipView.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveAlertTipView.h | ||
| 3 | +// CNLiveCServiceModule | ||
| 4 | +// | ||
| 5 | +// Created by CNLive on 2021/12/3. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import <UIKit/UIKit.h> | ||
| 9 | + | ||
| 10 | +NS_ASSUME_NONNULL_BEGIN | ||
| 11 | + | ||
| 12 | +@interface CNLiveAlertTipView : UIView | ||
| 13 | ++ (void)showTipsInViewSureBlock:(void(^)(BOOL neverShow))sureBlock; | ||
| 14 | +@end | ||
| 15 | + | ||
| 16 | +NS_ASSUME_NONNULL_END |
CNLiveCServiceModule/Classes/View/CNLiveAlertTipView.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveAlertTipView.m | ||
| 3 | +// CNLiveCServiceModule | ||
| 4 | +// | ||
| 5 | +// Created by CNLive on 2021/12/3. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +#import "CNLiveAlertTipView.h" | ||
| 9 | + | ||
| 10 | +@interface CNLiveAlertTipView() | ||
| 11 | +@property (nonatomic, strong)UILabel *titleLabel; | ||
| 12 | +@property (nonatomic, strong)UILabel *messageLabel; | ||
| 13 | +@property (nonatomic, strong)UIButton *cancelBtn; | ||
| 14 | +@property (nonatomic, strong)UIButton *sureBtn; | ||
| 15 | +@property (nonatomic, strong)UIButton *notShowBtn; | ||
| 16 | +@end | ||
| 17 | + | ||
| 18 | +@implementation CNLiveAlertTipView | ||
| 19 | + | ||
| 20 | ++ (void)showTipsInViewSureBlock:(void (^)(BOOL))sureBlock | ||
| 21 | +{ | ||
| 22 | + CNLiveAlertTipView *tipView = [[CNLiveAlertTipView alloc] initWithFrame:CGRectMake(0, 0, 285, 379.5)]; | ||
| 23 | + tipView.backgroundColor = kWhiteColor; | ||
| 24 | + tipView.layer.cornerRadius = 10; | ||
| 25 | + [tipView addSubview:tipView.titleLabel]; | ||
| 26 | + [tipView addSubview:tipView.messageLabel]; | ||
| 27 | + [tipView addSubview:tipView.cancelBtn]; | ||
| 28 | + [tipView addSubview:tipView.sureBtn]; | ||
| 29 | + [tipView addSubview:tipView.notShowBtn]; | ||
| 30 | + tipView.titleLabel.text = @"免责声明"; | ||
| 31 | + [tipView.titleLabel sizeToFit]; | ||
| 32 | + [tipView.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 33 | + make.top.equalTo(tipView).offset(25); | ||
| 34 | + make.centerX.mas_equalTo(tipView); | ||
| 35 | + }]; | ||
| 36 | + tipView.messageLabel.text = @"1、每人每天有5次投票机会,在网家家APP内参与该活动最多可投5票。在微信、QQ等平台参与该活动最多可投3票;投票机会0点重置。\n\n2、本活动禁止刷票,凡是通过非正常手段刷票获取票数的行为,系统检测到并核实后将取消参赛资格。凡是通过非正常手段刷票获取票数的行为,系统检测到并核实后将取消参赛资。"; | ||
| 37 | + [tipView.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 38 | + make.top.equalTo(tipView.titleLabel.mas_bottom); | ||
| 39 | + make.width.offset(255); | ||
| 40 | + make.height.offset(185); | ||
| 41 | + make.centerX.mas_equalTo(tipView); | ||
| 42 | + }]; | ||
| 43 | + | ||
| 44 | + [tipView.cancelBtn setTitle:@"拒绝" forState:UIControlStateNormal]; | ||
| 45 | + [tipView.sureBtn setTitle:@"接受" forState:UIControlStateNormal]; | ||
| 46 | + [tipView.cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 47 | + make.left.equalTo(tipView).offset(15); | ||
| 48 | + make.bottom.equalTo(tipView).offset(-20); | ||
| 49 | + make.width.offset(120); | ||
| 50 | + make.height.offset(39); | ||
| 51 | + }]; | ||
| 52 | + [tipView.sureBtn mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 53 | + make.right.equalTo(tipView).offset(-15); | ||
| 54 | + make.bottom.equalTo(tipView.cancelBtn); | ||
| 55 | + make.width.offset(120); | ||
| 56 | + make.height.offset(39); | ||
| 57 | + }]; | ||
| 58 | + [tipView.notShowBtn mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 59 | + make.bottom.equalTo(tipView.cancelBtn.mas_top).offset(-10); | ||
| 60 | + make.width.offset(105); | ||
| 61 | + make.height.offset(20); | ||
| 62 | + make.left.equalTo(tipView).offset(15); | ||
| 63 | + }]; | ||
| 64 | + QMUIModalPresentationViewController *modalViewController = [[QMUIModalPresentationViewController alloc] init]; | ||
| 65 | + modalViewController.contentView = tipView; | ||
| 66 | + modalViewController.modal = YES; | ||
| 67 | + [modalViewController showWithAnimated:YES completion:nil]; | ||
| 68 | + __weak typeof(modalViewController) weakModalViewController = modalViewController; | ||
| 69 | + __weak typeof(tipView) weakTipView = tipView; | ||
| 70 | + [tipView.cancelBtn addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) { | ||
| 71 | + [weakModalViewController hideWithAnimated:YES completion:nil]; | ||
| 72 | + }]; | ||
| 73 | + [tipView.sureBtn addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) { | ||
| 74 | + [weakModalViewController hideWithAnimated:YES completion:^(BOOL finished) { | ||
| 75 | + if (finished&&sureBlock) { | ||
| 76 | + sureBlock(weakTipView.notShowBtn.isSelected); | ||
| 77 | + } | ||
| 78 | + }]; | ||
| 79 | + }]; | ||
| 80 | +} | ||
| 81 | +#pragma mark - Action | ||
| 82 | +-(void)notShowBtnClick:(UIButton *)sender{ | ||
| 83 | + sender.selected = !sender.isSelected; | ||
| 84 | +} | ||
| 85 | +#pragma mark - Getting&&Setting | ||
| 86 | +- (UILabel *)titleLabel | ||
| 87 | +{ | ||
| 88 | + if (!_titleLabel) { | ||
| 89 | + _titleLabel = [[UILabel alloc] init]; | ||
| 90 | + _titleLabel.textAlignment = NSTextAlignmentCenter; | ||
| 91 | + _titleLabel.textColor = CNLiveColorWithHexString(@"#333333"); | ||
| 92 | + _titleLabel.font = UIFontMake(17); | ||
| 93 | + } | ||
| 94 | + return _titleLabel; | ||
| 95 | +} | ||
| 96 | +-(UILabel *)messageLabel | ||
| 97 | +{ | ||
| 98 | + if (!_messageLabel) { | ||
| 99 | + _messageLabel = [[UILabel alloc] init]; | ||
| 100 | + _messageLabel.textAlignment = NSTextAlignmentCenter; | ||
| 101 | + _messageLabel.textColor = CNLiveColorWithHexString(@"#333333"); | ||
| 102 | + _messageLabel.font = UIFontMake(13); | ||
| 103 | + _messageLabel.numberOfLines = 0; | ||
| 104 | + } | ||
| 105 | + return _messageLabel; | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +-(UIButton *)cancelBtn | ||
| 109 | +{ | ||
| 110 | + if (!_cancelBtn) { | ||
| 111 | + _cancelBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 112 | + [_cancelBtn setTitleColor:CNLiveColorWithHexString(@"#999999") forState:UIControlStateNormal]; | ||
| 113 | + _cancelBtn.layer.cornerRadius = 21; | ||
| 114 | + _cancelBtn.titleLabel.font = UIFontMake(16); | ||
| 115 | + _cancelBtn.backgroundColor = CNLiveColorWithHexString(@"#EEEEEE"); | ||
| 116 | + } | ||
| 117 | + return _cancelBtn; | ||
| 118 | +} | ||
| 119 | +-(UIButton *)sureBtn | ||
| 120 | +{ | ||
| 121 | + if (!_sureBtn) { | ||
| 122 | + _sureBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 123 | + [_sureBtn setTitleColor:kWhiteColor forState:UIControlStateNormal]; | ||
| 124 | + _sureBtn.layer.cornerRadius = 21; | ||
| 125 | + _sureBtn.titleLabel.font = UIFontMake(16); | ||
| 126 | + _sureBtn.backgroundColor = [UIColor colorWithPatternImage:[UIImage gradientImageWithColors:@[CNLiveColorWithHexString(@"#FFAA4A"),CNLiveColorWithHexString(@"#EC5645")] rect:CGRectMake(0, 0, 120, 39)]]; | ||
| 127 | + } | ||
| 128 | + return _sureBtn; | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | +- (UIButton *)notShowBtn | ||
| 132 | +{ | ||
| 133 | + if (!_notShowBtn) { | ||
| 134 | + _notShowBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 135 | + [_notShowBtn setImage:[UIImage loadCServiceBundle:@"tips_no"] forState:UIControlStateNormal]; | ||
| 136 | + [_notShowBtn setImage:[UIImage loadCServiceBundle:@"tips_select"] forState:UIControlStateSelected]; | ||
| 137 | + _notShowBtn.backgroundColor = kClearColor; | ||
| 138 | + [_notShowBtn setTitle:@"下次不再弹出" forState:UIControlStateNormal]; | ||
| 139 | + [_notShowBtn setTitleColor:CNLiveColorWithHexString(@"#F5A623") forState:UIControlStateNormal]; | ||
| 140 | + [_notShowBtn setTitle:@"下次不再弹出" forState:UIControlStateSelected]; | ||
| 141 | + [_notShowBtn setTitleColor:CNLiveColorWithHexString(@"#F5A623") forState:UIControlStateSelected]; | ||
| 142 | + _notShowBtn.titleLabel.font = UIFontMake(14); | ||
| 143 | + [_notShowBtn addTarget:self action:@selector(notShowBtnClick:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 144 | + } | ||
| 145 | + return _notShowBtn; | ||
| 146 | +} | ||
| 147 | +@end |
Example/CNLiveCServiceModule.xcodeproj/project.pbxproj
| @@ -359,6 +359,7 @@ | @@ -359,6 +359,7 @@ | ||
| 359 | "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework", | 359 | "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework", |
| 360 | "${BUILT_PRODUCTS_DIR}/SDCycleScrollView/SDCycleScrollView.framework", | 360 | "${BUILT_PRODUCTS_DIR}/SDCycleScrollView/SDCycleScrollView.framework", |
| 361 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", | 361 | "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", |
| 362 | + "${BUILT_PRODUCTS_DIR}/YYCategories/YYCategories.framework", | ||
| 362 | ); | 363 | ); |
| 363 | name = "[CP] Embed Pods Frameworks"; | 364 | name = "[CP] Embed Pods Frameworks"; |
| 364 | outputPaths = ( | 365 | outputPaths = ( |
| @@ -380,6 +381,7 @@ | @@ -380,6 +381,7 @@ | ||
| 380 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework", | 381 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework", |
| 381 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDCycleScrollView.framework", | 382 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDCycleScrollView.framework", |
| 382 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", | 383 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", |
| 384 | + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYCategories.framework", | ||
| 383 | ); | 385 | ); |
| 384 | runOnlyForDeploymentPostprocessing = 0; | 386 | runOnlyForDeploymentPostprocessing = 0; |
| 385 | shellPath = /bin/sh; | 387 | shellPath = /bin/sh; |