Commit 90f77b87b29ae895a2f10fbfd38c44368145a419
1 parent
6e6e98b8
0.0.3
Showing
6 changed files
with
510 additions
and
342 deletions
CNLiveTips.podspec
CNLiveTips/Classes/CNLiveShowTips.h
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTips.h | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2018/12/25. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveToastView.h" | ||
| 10 | + | ||
| 11 | +NS_ASSUME_NONNULL_BEGIN | ||
| 12 | +// 自动计算秒数的标志符,在 delay 里面赋值 QMUITipsAutomaticallyHideToastSeconds 即可通过自动计算 tips 消失的秒数 | ||
| 13 | +extern const NSInteger QMUITipsAutomaticallyHideToastSeconds; | ||
| 14 | + | ||
| 15 | +/// 默认的 parentView | ||
| 16 | +#define DefaultTipsParentView [[[UIApplication sharedApplication] delegate] window] | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 简单封装了 QMUIToastView,支持弹出纯文本、loading、succeed、error、info 等五种 tips。如果这些接口还满足不了业务的需求,可以通过 QMUITips 的分类自行添加接口。 | ||
| 20 | + * 注意用类方法显示 tips 的话,会导致父类的 willShowBlock 无法正常工作,具体请查看 willShowBlock 的注释。 | ||
| 21 | + * @see [QMUIToastView willShowBlock] | ||
| 22 | + */ | ||
| 23 | +@interface CNLiveShowTips : CNLiveToastView | ||
| 24 | +/// 实例方法:需要自己addSubview,hide之后不会自动removeFromSuperView | ||
| 25 | + | ||
| 26 | +- (void)showLoading; | ||
| 27 | +- (void)showLoading:(nullable NSString *)text; | ||
| 28 | +- (void)showLoadingHideAfterDelay:(NSTimeInterval)delay; | ||
| 29 | +- (void)showLoading:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 30 | +- (void)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 31 | +- (void)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 32 | + | ||
| 33 | +- (void)showWithText:(nullable NSString *)text; | ||
| 34 | +- (void)showWithText:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 35 | +- (void)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 36 | +- (void)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 37 | + | ||
| 38 | +- (void)showSucceed:(nullable NSString *)text; | ||
| 39 | +- (void)showSucceed:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 40 | +- (void)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 41 | +- (void)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 42 | + | ||
| 43 | +- (void)showError:(nullable NSString *)text; | ||
| 44 | +- (void)showError:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 45 | +- (void)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 46 | +- (void)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 47 | + | ||
| 48 | +- (void)showInfo:(nullable NSString *)text; | ||
| 49 | +- (void)showInfo:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 50 | +- (void)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 51 | +- (void)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 52 | + | ||
| 53 | +/// 类方法:主要用在局部一次性使用的场景,hide之后会自动removeFromSuperView | ||
| 54 | + | ||
| 55 | ++ (CNLiveShowTips *)createTipsToView:(UIView *)view; | ||
| 56 | + | ||
| 57 | ++ (CNLiveShowTips *)showLoadingInView:(UIView *)view; | ||
| 58 | ++ (CNLiveShowTips *)showLoading:(nullable NSString *)text inView:(UIView *)view; | ||
| 59 | ++ (CNLiveShowTips *)showLoadingInView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 60 | ++ (CNLiveShowTips *)showLoading:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 61 | ++ (CNLiveShowTips *)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 62 | ++ (CNLiveShowTips *)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 63 | + | ||
| 64 | ++ (CNLiveShowTips *)showWithText:(nullable NSString *)text; | ||
| 65 | ++ (CNLiveShowTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 66 | ++ (CNLiveShowTips *)showWithText:(nullable NSString *)text inView:(UIView *)view; | ||
| 67 | ++ (CNLiveShowTips *)showWithText:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 68 | ++ (CNLiveShowTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 69 | ++ (CNLiveShowTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 70 | + | ||
| 71 | ++ (CNLiveShowTips *)showSucceed:(nullable NSString *)text; | ||
| 72 | ++ (CNLiveShowTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 73 | ++ (CNLiveShowTips *)showSucceed:(nullable NSString *)text inView:(UIView *)view; | ||
| 74 | ++ (CNLiveShowTips *)showSucceed:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 75 | ++ (CNLiveShowTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 76 | ++ (CNLiveShowTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 77 | + | ||
| 78 | ++ (CNLiveShowTips *)showError:(nullable NSString *)text; | ||
| 79 | ++ (CNLiveShowTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 80 | ++ (CNLiveShowTips *)showError:(nullable NSString *)text inView:(UIView *)view; | ||
| 81 | ++ (CNLiveShowTips *)showError:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 82 | ++ (CNLiveShowTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 83 | ++ (CNLiveShowTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 84 | + | ||
| 85 | ++ (CNLiveShowTips *)showInfo:(nullable NSString *)text; | ||
| 86 | ++ (CNLiveShowTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 87 | ++ (CNLiveShowTips *)showInfo:(nullable NSString *)text inView:(UIView *)view; | ||
| 88 | ++ (CNLiveShowTips *)showInfo:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 89 | ++ (CNLiveShowTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 90 | ++ (CNLiveShowTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 91 | + | ||
| 92 | +/// 隐藏 tips | ||
| 93 | ++ (void)hideAllTipsInView:(UIView *)view; | ||
| 94 | ++ (void)hideAllTips; | ||
| 95 | + | ||
| 96 | +/// 自动隐藏 toast 可以使用这个方法自动计算秒数 | ||
| 97 | ++ (NSTimeInterval)smartDelaySecondsForTipsText:(NSString *)text; | ||
| 98 | +@end | ||
| 99 | + | ||
| 100 | +NS_ASSUME_NONNULL_END |
CNLiveTips/Classes/CNLiveShowTips.m
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveTips.m | ||
| 3 | +// CNLiveNetAdd | ||
| 4 | +// | ||
| 5 | +// Created by 殷巧娟 on 2018/12/25. | ||
| 6 | +// Copyright © 2018年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "CNLiveShowTips.h" | ||
| 10 | +#import <QMUIKit/QMUIKit.h> | ||
| 11 | +#import "QMUICore.h" | ||
| 12 | +#import "QMUIToastContentView.h" | ||
| 13 | +#import "QMUIToastBackgroundView.h" | ||
| 14 | +#import "NSString+QMUI.h" | ||
| 15 | +const NSInteger QMUITipsAutomaticallyHideToastSeconds = -1; | ||
| 16 | + | ||
| 17 | +@interface CNLiveShowTips () | ||
| 18 | +@property(nonatomic, strong) UIView *contentCustomView; | ||
| 19 | +@end | ||
| 20 | + | ||
| 21 | +@implementation CNLiveShowTips | ||
| 22 | +- (void)showLoading { | ||
| 23 | + [self showLoading:nil hideAfterDelay:0]; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +- (void)showLoadingHideAfterDelay:(NSTimeInterval)delay { | ||
| 27 | + [self showLoading:nil hideAfterDelay:delay]; | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +- (void)showLoading:(NSString *)text { | ||
| 31 | + [self showLoading:text hideAfterDelay:0]; | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +- (void)showLoading:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 35 | + [self showLoading:text detailText:nil hideAfterDelay:delay]; | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +- (void)showLoading:(NSString *)text detailText:(NSString *)detailText { | ||
| 39 | + [self showLoading:text detailText:detailText hideAfterDelay:0]; | ||
| 40 | +} | ||
| 41 | +- (void)showLoading:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 42 | + UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; | ||
| 43 | + [indicator startAnimating]; | ||
| 44 | + self.contentCustomView = indicator; | ||
| 45 | + [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +- (void)showWithText:(NSString *)text { | ||
| 49 | + [self showWithText:text detailText:nil hideAfterDelay:0]; | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +- (void)showWithText:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 53 | + [self showWithText:text detailText:nil hideAfterDelay:delay]; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +- (void)showWithText:(NSString *)text detailText:(NSString *)detailText { | ||
| 57 | + [self showWithText:text detailText:detailText hideAfterDelay:0]; | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +- (void)showWithText:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 61 | + self.contentCustomView = nil; | ||
| 62 | + [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +- (void)showSucceed:(NSString *)text { | ||
| 66 | + [self showSucceed:text detailText:nil hideAfterDelay:0]; | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +- (void)showSucceed:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 70 | + [self showSucceed:text detailText:nil hideAfterDelay:delay]; | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +- (void)showSucceed:(NSString *)text detailText:(NSString *)detailText { | ||
| 74 | + [self showSucceed:text detailText:detailText hideAfterDelay:0]; | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +- (void)showSucceed:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 78 | + self.contentCustomView = [[UIImageView alloc] initWithImage:[[QMUIHelper imageWithName:@"QMUI_tips_done"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; | ||
| 79 | + [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +- (void)showError:(NSString *)text { | ||
| 83 | + [self showError:text detailText:nil hideAfterDelay:0]; | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +- (void)showError:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 87 | + [self showError:text detailText:nil hideAfterDelay:delay]; | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +- (void)showError:(NSString *)text detailText:(NSString *)detailText { | ||
| 91 | + [self showError:text detailText:detailText hideAfterDelay:0]; | ||
| 92 | +} | ||
| 93 | + | ||
| 94 | +- (void)showError:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 95 | + self.contentCustomView = [[UIImageView alloc] initWithImage:[[QMUIHelper imageWithName:@"QMUI_tips_error"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; | ||
| 96 | + [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +- (void)showInfo:(NSString *)text { | ||
| 100 | + [self showInfo:text detailText:nil hideAfterDelay:0]; | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +- (void)showInfo:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 104 | + [self showInfo:text detailText:nil hideAfterDelay:delay]; | ||
| 105 | +} | ||
| 106 | + | ||
| 107 | +- (void)showInfo:(NSString *)text detailText:(NSString *)detailText { | ||
| 108 | + [self showInfo:text detailText:detailText hideAfterDelay:0]; | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | +- (void)showInfo:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 112 | + self.contentCustomView = [[UIImageView alloc] initWithImage:[[QMUIHelper imageWithName:@"QMUI_tips_info"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; | ||
| 113 | + [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | ||
| 114 | +} | ||
| 115 | + | ||
| 116 | +- (void)showTipWithText:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 117 | + | ||
| 118 | + QMUIToastContentView *contentView = (QMUIToastContentView *)self.contentView; | ||
| 119 | + contentView.customView = self.contentCustomView; | ||
| 120 | + | ||
| 121 | + contentView.textLabelText = text ?: @""; | ||
| 122 | + contentView.detailTextLabelText = detailText ?: @""; | ||
| 123 | + | ||
| 124 | + [self showAnimated:YES]; | ||
| 125 | + | ||
| 126 | + if (delay == QMUITipsAutomaticallyHideToastSeconds) { | ||
| 127 | + [self hideAnimated:YES afterDelay:[CNLiveShowTips smartDelaySecondsForTipsText:text]]; | ||
| 128 | + } else if (delay > 0) { | ||
| 129 | + [self hideAnimated:YES afterDelay:delay]; | ||
| 130 | + } | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | ++ (NSTimeInterval)smartDelaySecondsForTipsText:(NSString *)text { | ||
| 134 | + NSUInteger length = text.qmui_lengthWhenCountingNonASCIICharacterAsTwo; | ||
| 135 | + if (length <= 20) { | ||
| 136 | + return 1.5; | ||
| 137 | + } else if (length <= 40) { | ||
| 138 | + return 2.0; | ||
| 139 | + } else if (length <= 50) { | ||
| 140 | + return 2.5; | ||
| 141 | + } else { | ||
| 142 | + return 3.0; | ||
| 143 | + } | ||
| 144 | +} | ||
| 145 | + | ||
| 146 | ++ (CNLiveShowTips *)showLoadingInView:(UIView *)view { | ||
| 147 | + return [self showLoading:nil detailText:nil inView:view hideAfterDelay:0]; | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | ++ (CNLiveShowTips *)showLoading:(NSString *)text inView:(UIView *)view { | ||
| 151 | + return [self showLoading:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | ++ (CNLiveShowTips *)showLoadingInView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 155 | + return [self showLoading:nil detailText:nil inView:view hideAfterDelay:delay]; | ||
| 156 | +} | ||
| 157 | + | ||
| 158 | ++ (CNLiveShowTips *)showLoading:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 159 | + return [self showLoading:text detailText:nil inView:view hideAfterDelay:delay]; | ||
| 160 | +} | ||
| 161 | + | ||
| 162 | ++ (CNLiveShowTips *)showLoading:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 163 | + return [self showLoading:text detailText:detailText inView:view hideAfterDelay:0]; | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | ++ (CNLiveShowTips *)showLoading:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 167 | + CNLiveShowTips *tips = [self createTipsToView:view]; | ||
| 168 | + [tips showLoading:text detailText:detailText hideAfterDelay:delay]; | ||
| 169 | + return tips; | ||
| 170 | +} | ||
| 171 | + | ||
| 172 | ++ (CNLiveShowTips *)showWithText:(nullable NSString *)text { | ||
| 173 | + return [self showWithText:text detailText:nil inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | ++ (CNLiveShowTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText { | ||
| 177 | + return [self showWithText:text detailText:detailText inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 178 | +} | ||
| 179 | + | ||
| 180 | ++ (CNLiveShowTips *)showWithText:(NSString *)text inView:(UIView *)view { | ||
| 181 | + return [self showWithText:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 182 | +} | ||
| 183 | + | ||
| 184 | ++ (CNLiveShowTips *)showWithText:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 185 | + return [self showWithText:text detailText:nil inView:view hideAfterDelay:delay]; | ||
| 186 | +} | ||
| 187 | + | ||
| 188 | ++ (CNLiveShowTips *)showWithText:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 189 | + return [self showWithText:text detailText:detailText inView:view hideAfterDelay:0]; | ||
| 190 | +} | ||
| 191 | + | ||
| 192 | ++ (CNLiveShowTips *)showWithText:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 193 | + CNLiveShowTips *tips = [self createTipsToView:view]; | ||
| 194 | + [tips showWithText:text detailText:detailText hideAfterDelay:delay]; | ||
| 195 | + return tips; | ||
| 196 | +} | ||
| 197 | + | ||
| 198 | ++ (CNLiveShowTips *)showSucceed:(nullable NSString *)text { | ||
| 199 | + return [self showSucceed:text detailText:nil inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 200 | +} | ||
| 201 | + | ||
| 202 | ++ (CNLiveShowTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText { | ||
| 203 | + return [self showSucceed:text detailText:detailText inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 204 | +} | ||
| 205 | + | ||
| 206 | ++ (CNLiveShowTips *)showSucceed:(NSString *)text inView:(UIView *)view { | ||
| 207 | + return [self showSucceed:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 208 | +} | ||
| 209 | + | ||
| 210 | ++ (CNLiveShowTips *)showSucceed:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 211 | + return [self showSucceed:text detailText:nil inView:view hideAfterDelay:delay]; | ||
| 212 | +} | ||
| 213 | + | ||
| 214 | ++ (CNLiveShowTips *)showSucceed:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 215 | + return [self showSucceed:text detailText:detailText inView:view hideAfterDelay:0]; | ||
| 216 | +} | ||
| 217 | + | ||
| 218 | ++ (CNLiveShowTips *)showSucceed:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 219 | + CNLiveShowTips *tips = [self createTipsToView:view]; | ||
| 220 | + [tips showSucceed:text detailText:detailText hideAfterDelay:delay]; | ||
| 221 | + return tips; | ||
| 222 | +} | ||
| 223 | + | ||
| 224 | ++ (CNLiveShowTips *)showError:(nullable NSString *)text { | ||
| 225 | + return [self showError:text detailText:nil inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 226 | +} | ||
| 227 | + | ||
| 228 | ++ (CNLiveShowTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText { | ||
| 229 | + return [self showError:text detailText:detailText inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 230 | +} | ||
| 231 | + | ||
| 232 | ++ (CNLiveShowTips *)showError:(NSString *)text inView:(UIView *)view { | ||
| 233 | + return [self showError:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 234 | +} | ||
| 235 | + | ||
| 236 | ++ (CNLiveShowTips *)showError:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 237 | + return [self showError:text detailText:nil inView:view hideAfterDelay:delay]; | ||
| 238 | +} | ||
| 239 | + | ||
| 240 | ++ (CNLiveShowTips *)showError:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 241 | + return [self showError:text detailText:detailText inView:view hideAfterDelay:0]; | ||
| 242 | +} | ||
| 243 | + | ||
| 244 | ++ (CNLiveShowTips *)showError:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 245 | + CNLiveShowTips *tips = [self createTipsToView:view]; | ||
| 246 | + [tips showError:text detailText:detailText hideAfterDelay:delay]; | ||
| 247 | + return tips; | ||
| 248 | +} | ||
| 249 | + | ||
| 250 | ++ (CNLiveShowTips *)showInfo:(nullable NSString *)text { | ||
| 251 | + return [self showInfo:text detailText:nil inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 252 | +} | ||
| 253 | + | ||
| 254 | ++ (CNLiveShowTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText { | ||
| 255 | + return [self showInfo:text detailText:detailText inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 256 | +} | ||
| 257 | + | ||
| 258 | ++ (CNLiveShowTips *)showInfo:(NSString *)text inView:(UIView *)view { | ||
| 259 | + return [self showInfo:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 260 | +} | ||
| 261 | + | ||
| 262 | ++ (CNLiveShowTips *)showInfo:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 263 | + return [self showInfo:text detailText:nil inView:view hideAfterDelay:delay]; | ||
| 264 | +} | ||
| 265 | + | ||
| 266 | ++ (CNLiveShowTips *)showInfo:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 267 | + return [self showInfo:text detailText:detailText inView:view hideAfterDelay:0]; | ||
| 268 | +} | ||
| 269 | + | ||
| 270 | ++ (CNLiveShowTips *)showInfo:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 271 | + CNLiveShowTips *tips = [self createTipsToView:view]; | ||
| 272 | + [tips showInfo:text detailText:detailText hideAfterDelay:delay]; | ||
| 273 | + return tips; | ||
| 274 | +} | ||
| 275 | + | ||
| 276 | ++ (CNLiveShowTips *)createTipsToView:(UIView *)view { | ||
| 277 | + CNLiveShowTips *tips = [[CNLiveShowTips alloc] initWithView:view]; | ||
| 278 | + [view addSubview:tips]; | ||
| 279 | + tips.removeFromSuperViewWhenHide = YES; | ||
| 280 | + return tips; | ||
| 281 | +} | ||
| 282 | + | ||
| 283 | ++ (void)hideAllTipsInView:(UIView *)view { | ||
| 284 | + [self hideAllToastInView:view animated:NO]; | ||
| 285 | +} | ||
| 286 | + | ||
| 287 | ++ (void)hideAllTips { | ||
| 288 | + [self hideAllToastInView:nil animated:NO]; | ||
| 289 | +} | ||
| 290 | + | ||
| 291 | +@end |
CNLiveTips/Classes/CNLiveTips.h
| 1 | // | 1 | // |
| 2 | // CNLiveTips.h | 2 | // CNLiveTips.h |
| 3 | -// CNLiveNetAdd | 3 | +// CNLiveTips |
| 4 | // | 4 | // |
| 5 | -// Created by 殷巧娟 on 2018/12/25. | ||
| 6 | -// Copyright © 2018年 cnlive. All rights reserved. | 5 | +// Created by 殷巧娟 on 2019/1/18. |
| 7 | // | 6 | // |
| 8 | 7 | ||
| 9 | -#import "CNLiveToastView.h" | 8 | +#import <Foundation/Foundation.h> |
| 10 | 9 | ||
| 11 | NS_ASSUME_NONNULL_BEGIN | 10 | NS_ASSUME_NONNULL_BEGIN |
| 12 | -// 自动计算秒数的标志符,在 delay 里面赋值 QMUITipsAutomaticallyHideToastSeconds 即可通过自动计算 tips 消失的秒数 | ||
| 13 | -extern const NSInteger QMUITipsAutomaticallyHideToastSeconds; | ||
| 14 | 11 | ||
| 15 | -/// 默认的 parentView | ||
| 16 | -#define DefaultTipsParentView [[[UIApplication sharedApplication] delegate] window] | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * 简单封装了 QMUIToastView,支持弹出纯文本、loading、succeed、error、info 等五种 tips。如果这些接口还满足不了业务的需求,可以通过 QMUITips 的分类自行添加接口。 | ||
| 20 | - * 注意用类方法显示 tips 的话,会导致父类的 willShowBlock 无法正常工作,具体请查看 willShowBlock 的注释。 | ||
| 21 | - * @see [QMUIToastView willShowBlock] | ||
| 22 | - */ | ||
| 23 | -@interface CNLiveTips : CNLiveToastView | ||
| 24 | -/// 实例方法:需要自己addSubview,hide之后不会自动removeFromSuperView | ||
| 25 | - | ||
| 26 | -- (void)showLoading; | ||
| 27 | -- (void)showLoading:(nullable NSString *)text; | ||
| 28 | -- (void)showLoadingHideAfterDelay:(NSTimeInterval)delay; | ||
| 29 | -- (void)showLoading:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 30 | -- (void)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 31 | -- (void)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 32 | - | ||
| 33 | -- (void)showWithText:(nullable NSString *)text; | ||
| 34 | -- (void)showWithText:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 35 | -- (void)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 36 | -- (void)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 37 | - | ||
| 38 | -- (void)showSucceed:(nullable NSString *)text; | ||
| 39 | -- (void)showSucceed:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 40 | -- (void)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 41 | -- (void)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 42 | - | ||
| 43 | -- (void)showError:(nullable NSString *)text; | ||
| 44 | -- (void)showError:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 45 | -- (void)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 46 | -- (void)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 47 | - | ||
| 48 | -- (void)showInfo:(nullable NSString *)text; | ||
| 49 | -- (void)showInfo:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay; | ||
| 50 | -- (void)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 51 | -- (void)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay; | ||
| 52 | - | ||
| 53 | -/// 类方法:主要用在局部一次性使用的场景,hide之后会自动removeFromSuperView | ||
| 54 | - | ||
| 55 | -+ (CNLiveTips *)createTipsToView:(UIView *)view; | ||
| 56 | - | ||
| 57 | -+ (CNLiveTips *)showLoadingInView:(UIView *)view; | ||
| 58 | -+ (CNLiveTips *)showLoading:(nullable NSString *)text inView:(UIView *)view; | ||
| 59 | -+ (CNLiveTips *)showLoadingInView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 60 | -+ (CNLiveTips *)showLoading:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 61 | -+ (CNLiveTips *)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 62 | -+ (CNLiveTips *)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 63 | - | ||
| 64 | -+ (CNLiveTips *)showWithText:(nullable NSString *)text; | ||
| 65 | -+ (CNLiveTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 66 | -+ (CNLiveTips *)showWithText:(nullable NSString *)text inView:(UIView *)view; | ||
| 67 | -+ (CNLiveTips *)showWithText:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 68 | -+ (CNLiveTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 69 | -+ (CNLiveTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 70 | - | ||
| 71 | -+ (CNLiveTips *)showSucceed:(nullable NSString *)text; | ||
| 72 | -+ (CNLiveTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 73 | -+ (CNLiveTips *)showSucceed:(nullable NSString *)text inView:(UIView *)view; | ||
| 74 | -+ (CNLiveTips *)showSucceed:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 75 | -+ (CNLiveTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 76 | -+ (CNLiveTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 77 | - | ||
| 78 | -+ (CNLiveTips *)showError:(nullable NSString *)text; | ||
| 79 | -+ (CNLiveTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 80 | -+ (CNLiveTips *)showError:(nullable NSString *)text inView:(UIView *)view; | ||
| 81 | -+ (CNLiveTips *)showError:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 82 | -+ (CNLiveTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 83 | -+ (CNLiveTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 84 | - | ||
| 85 | -+ (CNLiveTips *)showInfo:(nullable NSString *)text; | ||
| 86 | -+ (CNLiveTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 87 | -+ (CNLiveTips *)showInfo:(nullable NSString *)text inView:(UIView *)view; | ||
| 88 | -+ (CNLiveTips *)showInfo:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 89 | -+ (CNLiveTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view; | ||
| 90 | -+ (CNLiveTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 91 | - | ||
| 92 | -/// 隐藏 tips | 12 | +@interface CNLiveTips : NSObject |
| 13 | ++ (void)showLoadingInView:(UIView *)view; | ||
| 14 | ++ (void)showLoading:(NSString *)text inView:(UIView *)view; | ||
| 15 | ++ (void)showLoadingInView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 16 | ++ (void)showLoading:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 17 | ++ (void)showLoading:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view; | ||
| 18 | ++ (void)showLoading:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 19 | ++ (void)showWithText:(nullable NSString *)text; | ||
| 20 | ++ (void)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 21 | ++ (void)showWithText:(NSString *)text inView:(UIView *)view; | ||
| 22 | ++ (void)showWithText:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 23 | ++ (void)showWithText:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view; | ||
| 24 | ++ (void)showWithText:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 25 | ++ (void)showSucceed:(nullable NSString *)text; | ||
| 26 | ++ (void)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 27 | ++ (void)showSucceed:(NSString *)text inView:(UIView *)view; | ||
| 28 | ++ (void)showSucceed:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 29 | ++ (void)showSucceed:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view; | ||
| 30 | ++ (void)showSucceed:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 31 | ++ (void)showError:(nullable NSString *)text; | ||
| 32 | ++ (void)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 33 | ++ (void)showError:(NSString *)text inView:(UIView *)view; | ||
| 34 | ++ (void)showError:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 35 | ++ (void)showError:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view; | ||
| 36 | ++ (void)showError:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 37 | ++ (void)showInfo:(nullable NSString *)text; | ||
| 38 | ++ (void)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText; | ||
| 39 | ++ (void)showInfo:(NSString *)text inView:(UIView *)view; | ||
| 40 | ++ (void)showInfo:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 41 | ++ (void)showInfo:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view; | ||
| 42 | ++ (void)showInfo:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay; | ||
| 43 | ++ (void)createTipsToView:(UIView *)view; | ||
| 93 | + (void)hideAllTipsInView:(UIView *)view; | 44 | + (void)hideAllTipsInView:(UIView *)view; |
| 94 | + (void)hideAllTips; | 45 | + (void)hideAllTips; |
| 95 | - | ||
| 96 | -/// 自动隐藏 toast 可以使用这个方法自动计算秒数 | ||
| 97 | -+ (NSTimeInterval)smartDelaySecondsForTipsText:(NSString *)text; | ||
| 98 | @end | 46 | @end |
| 99 | 47 | ||
| 100 | NS_ASSUME_NONNULL_END | 48 | NS_ASSUME_NONNULL_END |
CNLiveTips/Classes/CNLiveTips.m
| 1 | // | 1 | // |
| 2 | // CNLiveTips.m | 2 | // CNLiveTips.m |
| 3 | -// CNLiveNetAdd | 3 | +// CNLiveTips |
| 4 | // | 4 | // |
| 5 | -// Created by 殷巧娟 on 2018/12/25. | ||
| 6 | -// Copyright © 2018年 cnlive. All rights reserved. | 5 | +// Created by 殷巧娟 on 2019/1/18. |
| 7 | // | 6 | // |
| 8 | 7 | ||
| 9 | #import "CNLiveTips.h" | 8 | #import "CNLiveTips.h" |
| 10 | -#import <QMUIKit/QMUIKit.h> | ||
| 11 | -#import "QMUICore.h" | ||
| 12 | -#import "QMUIToastContentView.h" | ||
| 13 | -#import "QMUIToastBackgroundView.h" | ||
| 14 | -#import "NSString+QMUI.h" | ||
| 15 | -const NSInteger QMUITipsAutomaticallyHideToastSeconds = -1; | ||
| 16 | - | ||
| 17 | -@interface CNLiveTips () | ||
| 18 | -@property(nonatomic, strong) UIView *contentCustomView; | ||
| 19 | -@end | ||
| 20 | 9 | ||
| 10 | +#import<QMUIKit/QMUITips.h> | ||
| 21 | @implementation CNLiveTips | 11 | @implementation CNLiveTips |
| 22 | -- (void)showLoading { | ||
| 23 | - [self showLoading:nil hideAfterDelay:0]; | ||
| 24 | -} | ||
| 25 | 12 | ||
| 26 | -- (void)showLoadingHideAfterDelay:(NSTimeInterval)delay { | ||
| 27 | - [self showLoading:nil hideAfterDelay:delay]; | 13 | ++ (void)showLoadingInView:(UIView *)view{ |
| 14 | + [QMUITips showLoadingInView:view]; | ||
| 28 | } | 15 | } |
| 29 | - | ||
| 30 | -- (void)showLoading:(NSString *)text { | ||
| 31 | - [self showLoading:text hideAfterDelay:0]; | 16 | ++ (void)showLoading:(NSString *)text inView:(UIView *)view { |
| 17 | + [QMUITips showLoading:text inView:view]; | ||
| 32 | } | 18 | } |
| 33 | - | ||
| 34 | -- (void)showLoading:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 35 | - [self showLoading:text detailText:nil hideAfterDelay:delay]; | 19 | ++ (void)showLoadingInView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 20 | + [QMUITips showLoadingInView:view hideAfterDelay:delay]; | ||
| 36 | } | 21 | } |
| 37 | - | ||
| 38 | -- (void)showLoading:(NSString *)text detailText:(NSString *)detailText { | ||
| 39 | - [self showLoading:text detailText:detailText hideAfterDelay:0]; | 22 | ++ (void)showLoading:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 23 | + [QMUITips showLoading:text inView:view hideAfterDelay:delay]; | ||
| 40 | } | 24 | } |
| 41 | -- (void)showLoading:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 42 | - UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; | ||
| 43 | - [indicator startAnimating]; | ||
| 44 | - self.contentCustomView = indicator; | ||
| 45 | - [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | 25 | ++ (void)showLoading:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { |
| 26 | + [QMUITips showLoading:text detailText:detailText inView:view]; | ||
| 46 | } | 27 | } |
| 47 | - | ||
| 48 | -- (void)showWithText:(NSString *)text { | ||
| 49 | - [self showWithText:text detailText:nil hideAfterDelay:0]; | 28 | ++ (void)showLoading:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 29 | + [QMUITips showLoading:text detailText:detailText inView:view hideAfterDelay:delay]; | ||
| 50 | } | 30 | } |
| 51 | - | ||
| 52 | -- (void)showWithText:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 53 | - [self showWithText:text detailText:nil hideAfterDelay:delay]; | 31 | ++ (void)showWithText:(nullable NSString *)text { |
| 32 | + [QMUITips showWithText:text]; | ||
| 54 | } | 33 | } |
| 55 | - | ||
| 56 | -- (void)showWithText:(NSString *)text detailText:(NSString *)detailText { | ||
| 57 | - [self showWithText:text detailText:detailText hideAfterDelay:0]; | 34 | ++ (void)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText { |
| 35 | + [QMUITips showWithText:text detailText:detailText]; | ||
| 58 | } | 36 | } |
| 59 | - | ||
| 60 | -- (void)showWithText:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 61 | - self.contentCustomView = nil; | ||
| 62 | - [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | 37 | ++ (void)showWithText:(NSString *)text inView:(UIView *)view { |
| 38 | + [QMUITips showWithText:text inView:view]; | ||
| 63 | } | 39 | } |
| 64 | - | ||
| 65 | -- (void)showSucceed:(NSString *)text { | ||
| 66 | - [self showSucceed:text detailText:nil hideAfterDelay:0]; | 40 | ++ (void)showWithText:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 41 | + [QMUITips showWithText:text inView:view hideAfterDelay:delay]; | ||
| 67 | } | 42 | } |
| 68 | - | ||
| 69 | -- (void)showSucceed:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 70 | - [self showSucceed:text detailText:nil hideAfterDelay:delay]; | 43 | ++ (void)showWithText:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { |
| 44 | + [QMUITips showWithText:text detailText:detailText inView:view]; | ||
| 71 | } | 45 | } |
| 72 | - | ||
| 73 | -- (void)showSucceed:(NSString *)text detailText:(NSString *)detailText { | ||
| 74 | - [self showSucceed:text detailText:detailText hideAfterDelay:0]; | 46 | ++ (void)showWithText:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 47 | + [QMUITips showWithText:text detailText:detailText inView:view hideAfterDelay:delay]; | ||
| 75 | } | 48 | } |
| 76 | - | ||
| 77 | -- (void)showSucceed:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 78 | - self.contentCustomView = [[UIImageView alloc] initWithImage:[[QMUIHelper imageWithName:@"QMUI_tips_done"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; | ||
| 79 | - [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | 49 | ++ (void)showSucceed:(nullable NSString *)text { |
| 50 | + [QMUITips showSucceed:text]; | ||
| 80 | } | 51 | } |
| 81 | - | ||
| 82 | -- (void)showError:(NSString *)text { | ||
| 83 | - [self showError:text detailText:nil hideAfterDelay:0]; | 52 | ++ (void)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText { |
| 53 | + [QMUITips showSucceed:text detailText:detailText]; | ||
| 84 | } | 54 | } |
| 85 | - | ||
| 86 | -- (void)showError:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 87 | - [self showError:text detailText:nil hideAfterDelay:delay]; | 55 | ++ (void)showSucceed:(NSString *)text inView:(UIView *)view { |
| 56 | + [QMUITips showSucceed:text inView:view]; | ||
| 88 | } | 57 | } |
| 89 | - | ||
| 90 | -- (void)showError:(NSString *)text detailText:(NSString *)detailText { | ||
| 91 | - [self showError:text detailText:detailText hideAfterDelay:0]; | 58 | ++ (void)showSucceed:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 59 | + [QMUITips showSucceed:text inView:view hideAfterDelay:delay]; | ||
| 92 | } | 60 | } |
| 93 | - | ||
| 94 | -- (void)showError:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 95 | - self.contentCustomView = [[UIImageView alloc] initWithImage:[[QMUIHelper imageWithName:@"QMUI_tips_error"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; | ||
| 96 | - [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | 61 | ++ (void)showSucceed:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { |
| 62 | + [QMUITips showSucceed:text detailText:detailText inView:view]; | ||
| 97 | } | 63 | } |
| 98 | - | ||
| 99 | -- (void)showInfo:(NSString *)text { | ||
| 100 | - [self showInfo:text detailText:nil hideAfterDelay:0]; | 64 | ++ (void)showSucceed:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 65 | + [QMUITips showSucceed:text detailText:detailText inView:view hideAfterDelay:delay]; | ||
| 101 | } | 66 | } |
| 102 | - | ||
| 103 | -- (void)showInfo:(NSString *)text hideAfterDelay:(NSTimeInterval)delay { | ||
| 104 | - [self showInfo:text detailText:nil hideAfterDelay:delay]; | 67 | ++ (void)showError:(nullable NSString *)text { |
| 68 | + [QMUITips showError:text]; | ||
| 105 | } | 69 | } |
| 106 | - | ||
| 107 | -- (void)showInfo:(NSString *)text detailText:(NSString *)detailText { | ||
| 108 | - [self showInfo:text detailText:detailText hideAfterDelay:0]; | 70 | ++ (void)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText{ |
| 71 | + [QMUITips showError:text detailText:detailText]; | ||
| 109 | } | 72 | } |
| 110 | - | ||
| 111 | -- (void)showInfo:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 112 | - self.contentCustomView = [[UIImageView alloc] initWithImage:[[QMUIHelper imageWithName:@"QMUI_tips_info"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]]; | ||
| 113 | - [self showTipWithText:text detailText:detailText hideAfterDelay:delay]; | ||
| 114 | -} | ||
| 115 | - | ||
| 116 | -- (void)showTipWithText:(NSString *)text detailText:(NSString *)detailText hideAfterDelay:(NSTimeInterval)delay { | ||
| 117 | - | ||
| 118 | - QMUIToastContentView *contentView = (QMUIToastContentView *)self.contentView; | ||
| 119 | - contentView.customView = self.contentCustomView; | ||
| 120 | - | ||
| 121 | - contentView.textLabelText = text ?: @""; | ||
| 122 | - contentView.detailTextLabelText = detailText ?: @""; | ||
| 123 | - | ||
| 124 | - [self showAnimated:YES]; | ||
| 125 | - | ||
| 126 | - if (delay == QMUITipsAutomaticallyHideToastSeconds) { | ||
| 127 | - [self hideAnimated:YES afterDelay:[CNLiveTips smartDelaySecondsForTipsText:text]]; | ||
| 128 | - } else if (delay > 0) { | ||
| 129 | - [self hideAnimated:YES afterDelay:delay]; | ||
| 130 | - } | ||
| 131 | -} | ||
| 132 | - | ||
| 133 | -+ (NSTimeInterval)smartDelaySecondsForTipsText:(NSString *)text { | ||
| 134 | - NSUInteger length = text.qmui_lengthWhenCountingNonASCIICharacterAsTwo; | ||
| 135 | - if (length <= 20) { | ||
| 136 | - return 1.5; | ||
| 137 | - } else if (length <= 40) { | ||
| 138 | - return 2.0; | ||
| 139 | - } else if (length <= 50) { | ||
| 140 | - return 2.5; | ||
| 141 | - } else { | ||
| 142 | - return 3.0; | ||
| 143 | - } | 73 | ++(void)showError:(NSString *)text inView:(UIView *)view { |
| 74 | + [QMUITips showError:text inView:view]; | ||
| 144 | } | 75 | } |
| 145 | - | ||
| 146 | -+ (CNLiveTips *)showLoadingInView:(UIView *)view { | ||
| 147 | - return [self showLoading:nil detailText:nil inView:view hideAfterDelay:0]; | ||
| 148 | -} | ||
| 149 | - | ||
| 150 | -+ (CNLiveTips *)showLoading:(NSString *)text inView:(UIView *)view { | ||
| 151 | - return [self showLoading:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 152 | -} | ||
| 153 | - | ||
| 154 | -+ (CNLiveTips *)showLoadingInView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 155 | - return [self showLoading:nil detailText:nil inView:view hideAfterDelay:delay]; | 76 | ++(void)showError:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay{ |
| 77 | + [QMUITips showError:text inView:view hideAfterDelay:delay]; | ||
| 156 | } | 78 | } |
| 157 | - | ||
| 158 | -+ (CNLiveTips *)showLoading:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 159 | - return [self showLoading:text detailText:nil inView:view hideAfterDelay:delay]; | 79 | ++ (void)showError:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { |
| 80 | + [QMUITips showError:text detailText:detailText inView:view]; | ||
| 160 | } | 81 | } |
| 161 | - | ||
| 162 | -+ (CNLiveTips *)showLoading:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 163 | - return [self showLoading:text detailText:detailText inView:view hideAfterDelay:0]; | 82 | ++ (void)showError:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 83 | + [QMUITips showError:text detailText:detailText inView:view hideAfterDelay:delay]; | ||
| 164 | } | 84 | } |
| 165 | - | ||
| 166 | -+ (CNLiveTips *)showLoading:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 167 | - CNLiveTips *tips = [self createTipsToView:view]; | ||
| 168 | - [tips showLoading:text detailText:detailText hideAfterDelay:delay]; | ||
| 169 | - return tips; | 85 | ++ (void)showInfo:(nullable NSString *)text { |
| 86 | + [QMUITips showInfo:text]; | ||
| 170 | } | 87 | } |
| 171 | - | ||
| 172 | -+ (CNLiveTips *)showWithText:(nullable NSString *)text { | ||
| 173 | - return [self showWithText:text detailText:nil inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | 88 | ++ (void)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText { |
| 89 | + [QMUITips showInfo:text detailText:detailText]; | ||
| 174 | } | 90 | } |
| 175 | - | ||
| 176 | -+ (CNLiveTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText { | ||
| 177 | - return [self showWithText:text detailText:detailText inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | 91 | ++ (void)showInfo:(NSString *)text inView:(UIView *)view { |
| 92 | + [QMUITips showInfo:text inView:view]; | ||
| 178 | } | 93 | } |
| 179 | - | ||
| 180 | -+ (CNLiveTips *)showWithText:(NSString *)text inView:(UIView *)view { | ||
| 181 | - return [self showWithText:text detailText:nil inView:view hideAfterDelay:0]; | 94 | ++ (void)showInfo:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 95 | + [QMUITips showInfo:text inView:view hideAfterDelay:delay]; | ||
| 182 | } | 96 | } |
| 183 | - | ||
| 184 | -+ (CNLiveTips *)showWithText:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 185 | - return [self showWithText:text detailText:nil inView:view hideAfterDelay:delay]; | 97 | ++ (void)showInfo:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { |
| 98 | + [QMUITips showInfo:text detailText:detailText inView:view]; | ||
| 186 | } | 99 | } |
| 187 | - | ||
| 188 | -+ (CNLiveTips *)showWithText:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 189 | - return [self showWithText:text detailText:detailText inView:view hideAfterDelay:0]; | 100 | ++ (void)showInfo:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { |
| 101 | + [QMUITips showInfo:text detailText:detailText inView:view hideAfterDelay:delay]; | ||
| 190 | } | 102 | } |
| 191 | - | ||
| 192 | -+ (CNLiveTips *)showWithText:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 193 | - CNLiveTips *tips = [self createTipsToView:view]; | ||
| 194 | - [tips showWithText:text detailText:detailText hideAfterDelay:delay]; | ||
| 195 | - return tips; | 103 | ++ (void)createTipsToView:(UIView *)view { |
| 104 | + [QMUITips createTipsToView:view]; | ||
| 196 | } | 105 | } |
| 197 | - | ||
| 198 | -+ (CNLiveTips *)showSucceed:(nullable NSString *)text { | ||
| 199 | - return [self showSucceed:text detailText:nil inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 200 | -} | ||
| 201 | - | ||
| 202 | -+ (CNLiveTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText { | ||
| 203 | - return [self showSucceed:text detailText:detailText inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 204 | -} | ||
| 205 | - | ||
| 206 | -+ (CNLiveTips *)showSucceed:(NSString *)text inView:(UIView *)view { | ||
| 207 | - return [self showSucceed:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 208 | -} | ||
| 209 | - | ||
| 210 | -+ (CNLiveTips *)showSucceed:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 211 | - return [self showSucceed:text detailText:nil inView:view hideAfterDelay:delay]; | ||
| 212 | -} | ||
| 213 | - | ||
| 214 | -+ (CNLiveTips *)showSucceed:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 215 | - return [self showSucceed:text detailText:detailText inView:view hideAfterDelay:0]; | ||
| 216 | -} | ||
| 217 | - | ||
| 218 | -+ (CNLiveTips *)showSucceed:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 219 | - CNLiveTips *tips = [self createTipsToView:view]; | ||
| 220 | - [tips showSucceed:text detailText:detailText hideAfterDelay:delay]; | ||
| 221 | - return tips; | ||
| 222 | -} | ||
| 223 | - | ||
| 224 | -+ (CNLiveTips *)showError:(nullable NSString *)text { | ||
| 225 | - return [self showError:text detailText:nil inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 226 | -} | ||
| 227 | - | ||
| 228 | -+ (CNLiveTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText { | ||
| 229 | - return [self showError:text detailText:detailText inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 230 | -} | ||
| 231 | - | ||
| 232 | -+ (CNLiveTips *)showError:(NSString *)text inView:(UIView *)view { | ||
| 233 | - return [self showError:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 234 | -} | ||
| 235 | - | ||
| 236 | -+ (CNLiveTips *)showError:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 237 | - return [self showError:text detailText:nil inView:view hideAfterDelay:delay]; | ||
| 238 | -} | ||
| 239 | - | ||
| 240 | -+ (CNLiveTips *)showError:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 241 | - return [self showError:text detailText:detailText inView:view hideAfterDelay:0]; | ||
| 242 | -} | ||
| 243 | - | ||
| 244 | -+ (CNLiveTips *)showError:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 245 | - CNLiveTips *tips = [self createTipsToView:view]; | ||
| 246 | - [tips showError:text detailText:detailText hideAfterDelay:delay]; | ||
| 247 | - return tips; | ||
| 248 | -} | ||
| 249 | - | ||
| 250 | -+ (CNLiveTips *)showInfo:(nullable NSString *)text { | ||
| 251 | - return [self showInfo:text detailText:nil inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 252 | -} | ||
| 253 | - | ||
| 254 | -+ (CNLiveTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText { | ||
| 255 | - return [self showInfo:text detailText:detailText inView:DefaultTipsParentView hideAfterDelay:QMUITipsAutomaticallyHideToastSeconds]; | ||
| 256 | -} | ||
| 257 | - | ||
| 258 | -+ (CNLiveTips *)showInfo:(NSString *)text inView:(UIView *)view { | ||
| 259 | - return [self showInfo:text detailText:nil inView:view hideAfterDelay:0]; | ||
| 260 | -} | ||
| 261 | - | ||
| 262 | -+ (CNLiveTips *)showInfo:(NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 263 | - return [self showInfo:text detailText:nil inView:view hideAfterDelay:delay]; | ||
| 264 | -} | ||
| 265 | - | ||
| 266 | -+ (CNLiveTips *)showInfo:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view { | ||
| 267 | - return [self showInfo:text detailText:detailText inView:view hideAfterDelay:0]; | ||
| 268 | -} | ||
| 269 | - | ||
| 270 | -+ (CNLiveTips *)showInfo:(NSString *)text detailText:(NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay { | ||
| 271 | - CNLiveTips *tips = [self createTipsToView:view]; | ||
| 272 | - [tips showInfo:text detailText:detailText hideAfterDelay:delay]; | ||
| 273 | - return tips; | ||
| 274 | -} | ||
| 275 | - | ||
| 276 | -+ (CNLiveTips *)createTipsToView:(UIView *)view { | ||
| 277 | - CNLiveTips *tips = [[CNLiveTips alloc] initWithView:view]; | ||
| 278 | - [view addSubview:tips]; | ||
| 279 | - tips.removeFromSuperViewWhenHide = YES; | ||
| 280 | - return tips; | ||
| 281 | -} | ||
| 282 | - | ||
| 283 | + (void)hideAllTipsInView:(UIView *)view { | 106 | + (void)hideAllTipsInView:(UIView *)view { |
| 284 | - [self hideAllToastInView:view animated:NO]; | 107 | + [QMUITips hideAllTipsInView:view]; |
| 285 | } | 108 | } |
| 286 | - | ||
| 287 | + (void)hideAllTips { | 109 | + (void)hideAllTips { |
| 288 | - [self hideAllToastInView:nil animated:NO]; | 110 | + [QMUITips hideAllTips]; |
| 289 | } | 111 | } |
| 290 | - | ||
| 291 | @end | 112 | @end |
Example/Pods/Pods.xcodeproj/project.pbxproj
| @@ -96,15 +96,17 @@ | @@ -96,15 +96,17 @@ | ||
| 96 | 4D774FC7539145EA644DB80AA5495E91 /* QMUILinkButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 39CA4E6D9642C1EA36A3E91C9A6E0472 /* QMUILinkButton.m */; }; | 96 | 4D774FC7539145EA644DB80AA5495E91 /* QMUILinkButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 39CA4E6D9642C1EA36A3E91C9A6E0472 /* QMUILinkButton.m */; }; |
| 97 | 4E08FB8D21D364300042166B /* CNLiveToastView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8021D364300042166B /* CNLiveToastView.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 97 | 4E08FB8D21D364300042166B /* CNLiveToastView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8021D364300042166B /* CNLiveToastView.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| 98 | 4E08FB8E21D364300042166B /* CNLiveToastContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8121D364300042166B /* CNLiveToastContentView.m */; }; | 98 | 4E08FB8E21D364300042166B /* CNLiveToastContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8121D364300042166B /* CNLiveToastContentView.m */; }; |
| 99 | - 4E08FB8F21D364300042166B /* CNLiveTips.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8221D364300042166B /* CNLiveTips.m */; }; | 99 | + 4E08FB8F21D364300042166B /* CNLiveShowTips.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8221D364300042166B /* CNLiveShowTips.m */; }; |
| 100 | 4E08FB9021D364300042166B /* CNLiveToastBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8321D364300042166B /* CNLiveToastBackgroundView.m */; }; | 100 | 4E08FB9021D364300042166B /* CNLiveToastBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8321D364300042166B /* CNLiveToastBackgroundView.m */; }; |
| 101 | 4E08FB9221D364300042166B /* CNLiveToastAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8521D364300042166B /* CNLiveToastAnimator.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 101 | 4E08FB9221D364300042166B /* CNLiveToastAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8521D364300042166B /* CNLiveToastAnimator.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| 102 | - 4E08FB9321D364300042166B /* CNLiveTips.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8621D364300042166B /* CNLiveTips.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 102 | + 4E08FB9321D364300042166B /* CNLiveShowTips.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8621D364300042166B /* CNLiveShowTips.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| 103 | 4E08FB9421D364300042166B /* CNLiveToastContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8721D364300042166B /* CNLiveToastContentView.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 103 | 4E08FB9421D364300042166B /* CNLiveToastContentView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8721D364300042166B /* CNLiveToastContentView.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| 104 | 4E08FB9521D364300042166B /* CNLiveToastView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8821D364300042166B /* CNLiveToastView.m */; }; | 104 | 4E08FB9521D364300042166B /* CNLiveToastView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8821D364300042166B /* CNLiveToastView.m */; }; |
| 105 | 4E08FB9621D364300042166B /* CNLiveToastBackgroundView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8921D364300042166B /* CNLiveToastBackgroundView.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 105 | 4E08FB9621D364300042166B /* CNLiveToastBackgroundView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E08FB8921D364300042166B /* CNLiveToastBackgroundView.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| 106 | 4E08FB9721D364300042166B /* CNLiveToastAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8A21D364300042166B /* CNLiveToastAnimator.m */; }; | 106 | 4E08FB9721D364300042166B /* CNLiveToastAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E08FB8A21D364300042166B /* CNLiveToastAnimator.m */; }; |
| 107 | 4E08FB9821D364300042166B /* .gitkeep in Resources */ = {isa = PBXBuildFile; fileRef = 4E08FB8C21D364300042166B /* .gitkeep */; }; | 107 | 4E08FB9821D364300042166B /* .gitkeep in Resources */ = {isa = PBXBuildFile; fileRef = 4E08FB8C21D364300042166B /* .gitkeep */; }; |
| 108 | + 4EBB278B21F1AC2700B3C91D /* CNLiveTips.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EBB278921F1AC2700B3C91D /* CNLiveTips.h */; }; | ||
| 109 | + 4EBB278C21F1AC2700B3C91D /* CNLiveTips.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EBB278A21F1AC2700B3C91D /* CNLiveTips.m */; }; | ||
| 108 | 4F3D26CB2FE6F03D02F0C49755CAD3D9 /* UICollectionView+QMUICellSizeKeyCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CCB6A17FB5E745A52EDC0FC41A4F8296 /* UICollectionView+QMUICellSizeKeyCache.m */; }; | 110 | 4F3D26CB2FE6F03D02F0C49755CAD3D9 /* UICollectionView+QMUICellSizeKeyCache.m in Sources */ = {isa = PBXBuildFile; fileRef = CCB6A17FB5E745A52EDC0FC41A4F8296 /* UICollectionView+QMUICellSizeKeyCache.m */; }; |
| 109 | 4F6471C98DB4C025AEACB51FEFB26363 /* QMUILogItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 6178F81A5DCE840951801F0B9BD0BBB9 /* QMUILogItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 111 | 4F6471C98DB4C025AEACB51FEFB26363 /* QMUILogItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 6178F81A5DCE840951801F0B9BD0BBB9 /* QMUILogItem.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| 110 | 5024A4F47B6AE06635A97D895919C068 /* NSArray+QMUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CBCC2CED44C83247713DE526F707C6A /* NSArray+QMUI.m */; }; | 112 | 5024A4F47B6AE06635A97D895919C068 /* NSArray+QMUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 2CBCC2CED44C83247713DE526F707C6A /* NSArray+QMUI.m */; }; |
| @@ -412,10 +414,10 @@ | @@ -412,10 +414,10 @@ | ||
| 412 | 4D850ABD913ABEBD0DDB6DF2CED64C70 /* QMUIToolbarButton.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QMUIToolbarButton.m; path = QMUIKit/QMUIComponents/QMUIButton/QMUIToolbarButton.m; sourceTree = "<group>"; }; | 414 | 4D850ABD913ABEBD0DDB6DF2CED64C70 /* QMUIToolbarButton.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QMUIToolbarButton.m; path = QMUIKit/QMUIComponents/QMUIButton/QMUIToolbarButton.m; sourceTree = "<group>"; }; |
| 413 | 4E08FB8021D364300042166B /* CNLiveToastView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveToastView.h; sourceTree = "<group>"; }; | 415 | 4E08FB8021D364300042166B /* CNLiveToastView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveToastView.h; sourceTree = "<group>"; }; |
| 414 | 4E08FB8121D364300042166B /* CNLiveToastContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveToastContentView.m; sourceTree = "<group>"; }; | 416 | 4E08FB8121D364300042166B /* CNLiveToastContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveToastContentView.m; sourceTree = "<group>"; }; |
| 415 | - 4E08FB8221D364300042166B /* CNLiveTips.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveTips.m; sourceTree = "<group>"; }; | 417 | + 4E08FB8221D364300042166B /* CNLiveShowTips.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveShowTips.m; sourceTree = "<group>"; }; |
| 416 | 4E08FB8321D364300042166B /* CNLiveToastBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveToastBackgroundView.m; sourceTree = "<group>"; }; | 418 | 4E08FB8321D364300042166B /* CNLiveToastBackgroundView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveToastBackgroundView.m; sourceTree = "<group>"; }; |
| 417 | 4E08FB8521D364300042166B /* CNLiveToastAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveToastAnimator.h; sourceTree = "<group>"; }; | 419 | 4E08FB8521D364300042166B /* CNLiveToastAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveToastAnimator.h; sourceTree = "<group>"; }; |
| 418 | - 4E08FB8621D364300042166B /* CNLiveTips.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveTips.h; sourceTree = "<group>"; }; | 420 | + 4E08FB8621D364300042166B /* CNLiveShowTips.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveShowTips.h; sourceTree = "<group>"; }; |
| 419 | 4E08FB8721D364300042166B /* CNLiveToastContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveToastContentView.h; sourceTree = "<group>"; }; | 421 | 4E08FB8721D364300042166B /* CNLiveToastContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveToastContentView.h; sourceTree = "<group>"; }; |
| 420 | 4E08FB8821D364300042166B /* CNLiveToastView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveToastView.m; sourceTree = "<group>"; }; | 422 | 4E08FB8821D364300042166B /* CNLiveToastView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveToastView.m; sourceTree = "<group>"; }; |
| 421 | 4E08FB8921D364300042166B /* CNLiveToastBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveToastBackgroundView.h; sourceTree = "<group>"; }; | 423 | 4E08FB8921D364300042166B /* CNLiveToastBackgroundView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveToastBackgroundView.h; sourceTree = "<group>"; }; |
| @@ -423,6 +425,8 @@ | @@ -423,6 +425,8 @@ | ||
| 423 | 4E08FB8C21D364300042166B /* .gitkeep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitkeep; sourceTree = "<group>"; }; | 425 | 4E08FB8C21D364300042166B /* .gitkeep */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitkeep; sourceTree = "<group>"; }; |
| 424 | 4EAB1C72CEACC749511F82D680CB3CF0 /* UITableView+QMUIStaticCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UITableView+QMUIStaticCell.h"; path = "QMUIKit/QMUIComponents/StaticTableView/UITableView+QMUIStaticCell.h"; sourceTree = "<group>"; }; | 426 | 4EAB1C72CEACC749511F82D680CB3CF0 /* UITableView+QMUIStaticCell.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UITableView+QMUIStaticCell.h"; path = "QMUIKit/QMUIComponents/StaticTableView/UITableView+QMUIStaticCell.h"; sourceTree = "<group>"; }; |
| 425 | 4EAD16142E5A442F1D766F3A5D49BB0D /* QMUIHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QMUIHelper.m; path = QMUIKit/QMUICore/QMUIHelper.m; sourceTree = "<group>"; }; | 427 | 4EAD16142E5A442F1D766F3A5D49BB0D /* QMUIHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QMUIHelper.m; path = QMUIKit/QMUICore/QMUIHelper.m; sourceTree = "<group>"; }; |
| 428 | + 4EBB278921F1AC2700B3C91D /* CNLiveTips.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CNLiveTips.h; sourceTree = "<group>"; }; | ||
| 429 | + 4EBB278A21F1AC2700B3C91D /* CNLiveTips.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CNLiveTips.m; sourceTree = "<group>"; }; | ||
| 426 | 4F1F717D2A0F5A721EB82C4F5487E962 /* QMUISearchBar.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QMUISearchBar.h; path = QMUIKit/QMUIComponents/QMUISearchBar.h; sourceTree = "<group>"; }; | 430 | 4F1F717D2A0F5A721EB82C4F5487E962 /* QMUISearchBar.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QMUISearchBar.h; path = QMUIKit/QMUIComponents/QMUISearchBar.h; sourceTree = "<group>"; }; |
| 427 | 4F99588BE293DF0528770A7C21A81FDB /* QMUIGridView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QMUIGridView.h; path = QMUIKit/QMUIComponents/QMUIGridView.h; sourceTree = "<group>"; }; | 431 | 4F99588BE293DF0528770A7C21A81FDB /* QMUIGridView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QMUIGridView.h; path = QMUIKit/QMUIComponents/QMUIGridView.h; sourceTree = "<group>"; }; |
| 428 | 4FBA584E8D69023B04F3E9C0EE13AC4B /* NSObject+QMUI.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSObject+QMUI.h"; path = "QMUIKit/UIKitExtensions/NSObject+QMUI.h"; sourceTree = "<group>"; }; | 432 | 4FBA584E8D69023B04F3E9C0EE13AC4B /* NSObject+QMUI.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSObject+QMUI.h"; path = "QMUIKit/UIKitExtensions/NSObject+QMUI.h"; sourceTree = "<group>"; }; |
| @@ -903,8 +907,10 @@ | @@ -903,8 +907,10 @@ | ||
| 903 | 4E08FB7F21D364300042166B /* Classes */ = { | 907 | 4E08FB7F21D364300042166B /* Classes */ = { |
| 904 | isa = PBXGroup; | 908 | isa = PBXGroup; |
| 905 | children = ( | 909 | children = ( |
| 906 | - 4E08FB8621D364300042166B /* CNLiveTips.h */, | ||
| 907 | - 4E08FB8221D364300042166B /* CNLiveTips.m */, | 910 | + 4E08FB8621D364300042166B /* CNLiveShowTips.h */, |
| 911 | + 4E08FB8221D364300042166B /* CNLiveShowTips.m */, | ||
| 912 | + 4EBB278921F1AC2700B3C91D /* CNLiveTips.h */, | ||
| 913 | + 4EBB278A21F1AC2700B3C91D /* CNLiveTips.m */, | ||
| 908 | 4E08FB8921D364300042166B /* CNLiveToastBackgroundView.h */, | 914 | 4E08FB8921D364300042166B /* CNLiveToastBackgroundView.h */, |
| 909 | 4E08FB8321D364300042166B /* CNLiveToastBackgroundView.m */, | 915 | 4E08FB8321D364300042166B /* CNLiveToastBackgroundView.m */, |
| 910 | 4E08FB8721D364300042166B /* CNLiveToastContentView.h */, | 916 | 4E08FB8721D364300042166B /* CNLiveToastContentView.h */, |
| @@ -1744,9 +1750,10 @@ | @@ -1744,9 +1750,10 @@ | ||
| 1744 | isa = PBXHeadersBuildPhase; | 1750 | isa = PBXHeadersBuildPhase; |
| 1745 | buildActionMask = 2147483647; | 1751 | buildActionMask = 2147483647; |
| 1746 | files = ( | 1752 | files = ( |
| 1747 | - 4E08FB9321D364300042166B /* CNLiveTips.h in Headers */, | 1753 | + 4E08FB9321D364300042166B /* CNLiveShowTips.h in Headers */, |
| 1748 | 4E08FB8D21D364300042166B /* CNLiveToastView.h in Headers */, | 1754 | 4E08FB8D21D364300042166B /* CNLiveToastView.h in Headers */, |
| 1749 | 4E08FB9421D364300042166B /* CNLiveToastContentView.h in Headers */, | 1755 | 4E08FB9421D364300042166B /* CNLiveToastContentView.h in Headers */, |
| 1756 | + 4EBB278B21F1AC2700B3C91D /* CNLiveTips.h in Headers */, | ||
| 1750 | 4E08FB9221D364300042166B /* CNLiveToastAnimator.h in Headers */, | 1757 | 4E08FB9221D364300042166B /* CNLiveToastAnimator.h in Headers */, |
| 1751 | 4E08FB9621D364300042166B /* CNLiveToastBackgroundView.h in Headers */, | 1758 | 4E08FB9621D364300042166B /* CNLiveToastBackgroundView.h in Headers */, |
| 1752 | 18352290EE9A979E4F0F9B8F2C3C4BBB /* CNLiveTips-umbrella.h in Headers */, | 1759 | 18352290EE9A979E4F0F9B8F2C3C4BBB /* CNLiveTips-umbrella.h in Headers */, |
| @@ -1916,12 +1923,13 @@ | @@ -1916,12 +1923,13 @@ | ||
| 1916 | isa = PBXSourcesBuildPhase; | 1923 | isa = PBXSourcesBuildPhase; |
| 1917 | buildActionMask = 2147483647; | 1924 | buildActionMask = 2147483647; |
| 1918 | files = ( | 1925 | files = ( |
| 1919 | - 4E08FB8F21D364300042166B /* CNLiveTips.m in Sources */, | 1926 | + 4E08FB8F21D364300042166B /* CNLiveShowTips.m in Sources */, |
| 1920 | 4E08FB9021D364300042166B /* CNLiveToastBackgroundView.m in Sources */, | 1927 | 4E08FB9021D364300042166B /* CNLiveToastBackgroundView.m in Sources */, |
| 1921 | 01A3A4DCE06B557F615925FFF32D1E5A /* CNLiveTips-dummy.m in Sources */, | 1928 | 01A3A4DCE06B557F615925FFF32D1E5A /* CNLiveTips-dummy.m in Sources */, |
| 1922 | 4E08FB8E21D364300042166B /* CNLiveToastContentView.m in Sources */, | 1929 | 4E08FB8E21D364300042166B /* CNLiveToastContentView.m in Sources */, |
| 1923 | 4E08FB9521D364300042166B /* CNLiveToastView.m in Sources */, | 1930 | 4E08FB9521D364300042166B /* CNLiveToastView.m in Sources */, |
| 1924 | 4E08FB9721D364300042166B /* CNLiveToastAnimator.m in Sources */, | 1931 | 4E08FB9721D364300042166B /* CNLiveToastAnimator.m in Sources */, |
| 1932 | + 4EBB278C21F1AC2700B3C91D /* CNLiveTips.m in Sources */, | ||
| 1925 | ); | 1933 | ); |
| 1926 | runOnlyForDeploymentPostprocessing = 0; | 1934 | runOnlyForDeploymentPostprocessing = 0; |
| 1927 | }; | 1935 | }; |