CNLiveShowTips.h
6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//
// CNLiveTips.h
// CNLiveNetAdd
//
// Created by 殷巧娟 on 2018/12/25.
// Copyright © 2018年 cnlive. All rights reserved.
//
#import "CNLiveToastView.h"
NS_ASSUME_NONNULL_BEGIN
// 自动计算秒数的标志符,在 delay 里面赋值 QMUITipsAutomaticallyHideToastSeconds 即可通过自动计算 tips 消失的秒数
extern const NSInteger QMUITipsAutomaticallyHideToastSeconds;
/// 默认的 parentView
#define DefaultTipsParentView [[[UIApplication sharedApplication] delegate] window]
/**
* 简单封装了 QMUIToastView,支持弹出纯文本、loading、succeed、error、info 等五种 tips。如果这些接口还满足不了业务的需求,可以通过 QMUITips 的分类自行添加接口。
* 注意用类方法显示 tips 的话,会导致父类的 willShowBlock 无法正常工作,具体请查看 willShowBlock 的注释。
* @see [QMUIToastView willShowBlock]
*/
@interface CNLiveShowTips : CNLiveToastView
/// 实例方法:需要自己addSubview,hide之后不会自动removeFromSuperView
- (void)showLoading;
- (void)showLoading:(nullable NSString *)text;
- (void)showLoadingHideAfterDelay:(NSTimeInterval)delay;
- (void)showLoading:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay;
- (void)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText;
- (void)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay;
- (void)showWithText:(nullable NSString *)text;
- (void)showWithText:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay;
- (void)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText;
- (void)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay;
- (void)showSucceed:(nullable NSString *)text;
- (void)showSucceed:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay;
- (void)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText;
- (void)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay;
- (void)showError:(nullable NSString *)text;
- (void)showError:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay;
- (void)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText;
- (void)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay;
- (void)showInfo:(nullable NSString *)text;
- (void)showInfo:(nullable NSString *)text hideAfterDelay:(NSTimeInterval)delay;
- (void)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText;
- (void)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText hideAfterDelay:(NSTimeInterval)delay;
/// 类方法:主要用在局部一次性使用的场景,hide之后会自动removeFromSuperView
+ (CNLiveShowTips *)createTipsToView:(UIView *)view;
+ (CNLiveShowTips *)showLoadingInView:(UIView *)view;
+ (CNLiveShowTips *)showLoading:(nullable NSString *)text inView:(UIView *)view;
+ (CNLiveShowTips *)showLoadingInView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showLoading:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view;
+ (CNLiveShowTips *)showLoading:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showWithText:(nullable NSString *)text;
+ (CNLiveShowTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText;
+ (CNLiveShowTips *)showWithText:(nullable NSString *)text inView:(UIView *)view;
+ (CNLiveShowTips *)showWithText:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view;
+ (CNLiveShowTips *)showWithText:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showSucceed:(nullable NSString *)text;
+ (CNLiveShowTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText;
+ (CNLiveShowTips *)showSucceed:(nullable NSString *)text inView:(UIView *)view;
+ (CNLiveShowTips *)showSucceed:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view;
+ (CNLiveShowTips *)showSucceed:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showError:(nullable NSString *)text;
+ (CNLiveShowTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText;
+ (CNLiveShowTips *)showError:(nullable NSString *)text inView:(UIView *)view;
+ (CNLiveShowTips *)showError:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view;
+ (CNLiveShowTips *)showError:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showInfo:(nullable NSString *)text;
+ (CNLiveShowTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText;
+ (CNLiveShowTips *)showInfo:(nullable NSString *)text inView:(UIView *)view;
+ (CNLiveShowTips *)showInfo:(nullable NSString *)text inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
+ (CNLiveShowTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view;
+ (CNLiveShowTips *)showInfo:(nullable NSString *)text detailText:(nullable NSString *)detailText inView:(UIView *)view hideAfterDelay:(NSTimeInterval)delay;
/// 隐藏 tips
+ (void)hideAllTipsInView:(UIView *)view;
+ (void)hideAllTips;
/// 自动隐藏 toast 可以使用这个方法自动计算秒数
+ (NSTimeInterval)smartDelaySecondsForTipsText:(NSString *)text;
@end
NS_ASSUME_NONNULL_END