BBATabBarController+Wrapper.h
3.21 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
101
102
103
104
105
106
107
108
109
110
111
112
//
// BBATabBarController+Wrapper.h
// BBAUIKit
//
// Created by performance on 2019/1/21.
//
#import "BBATabBarController.h"
NS_ASSUME_NONNULL_BEGIN
@interface BBATabBarController (Wrapper)
/**
* @brief 缓存根容器VC,避免部分场景下(交换rootVC)从而无法获取到真正的根容器,弱引用
* @param controller 根容器VC
*/
+ (void)setAppDelegateRootTabBarController:(BBATabBarController *)controller;
/**
* @brief 获取根容器VC, 默认从[UIApplication sharedApplication].delegate.window.rootViewController中取,取不到从缓存中取
*/
+ (BBATabBarController *)appDelegateRootTabBarController;
#pragma mark - register
/**
* @brief TabController的当前栈中是否存在对应的ID
* @param identify tab注册的ID
*/
+ (BOOL)isExistInStackWithID:(NSString *)identify;
/**
* @brief 如果TabController的子元素为UINavigationController及子类,判断栈顶是否是根控制器
* @param identify tab注册的ID
*/
+ (BOOL)isRootViewControllerAtTopmostWithID:(NSString *)identify;
/**
* @brief 获取Tab中的根ViewController(注意:VoiceSearch是可以隐藏的)
* @discussion 如果根为navigationController,则获取navigationController的rootViewController
* @param identify tab注册的ID
*/
+ (UIViewController *)rootViewControllerInTabWithID:(NSString *)identify;
/**
* @brief TabController的当前选中项索引是否为对应的ID
* @param identify tab注册的ID
*/
+ (BOOL)isSelectedTabWithID:(NSString *)identify;
/**
* @brief 切换Tab
* @param identify tab注册的ID
*/
+ (BOOL)didSelectTabWithID:(NSString *)identify;
/**
* @brief 切换Tab需要等待其他动画结束后
* @param identify tab注册的ID
*/
+ (BOOL)didSelectTabIndexNeedWaitWithID:(NSString *)identify;
/**
* @brief 显示/隐藏飘新(飘点)
* @discussion 如果TabBarController中displayBadgeDeselected属性设置为YES且高亮的是当前tab,切换Tab才显示,
* @param identify 要显示/隐藏的Tab
* @param isShow YES:显示,NO:隐藏
*/
+ (BOOL)showBadgeInTabIndexWithID:(NSString *)identify isShow:(BOOL)isShow;
/**
* @brief 显示/隐藏飘新(飘文字)
* @discussion 如果TabBarController中displayBadgeDeselected属性设置为YES且高亮的是当前tab,切换Tab才显示,
* @param identify 要显示/隐藏的Tab
* @param badgeString nil or @""取消飘字,
*/
+ (BOOL)showBadgeStringInTabWithID:(NSString *)identify badgeString:(NSString*)badgeString;
/**
* @brief tab飘气泡
* @param identify tab注册的ID
* @param text 气泡文字
* @param sucessBlock 气泡显示成功回掉block
* @param destroyedBlock 气泡销毁成功回掉block
*/
+ (BOOL)showBubbleInTabWithID:(NSString *)identify text:(NSString *)text showSucessBlock:(void (^)(void))sucessBlock bubbleDestroyedBlock:(void (^)(void))destroyedBlock;
/**
* @brief 首页tab是否存在气泡
*/
+ (BOOL)tabBubbleIsExist;
/**
* @brief 隐藏tab飘的气泡
*/
+ (void)hideTabBubble;
/**
* @brief 设置完TabBarItem标题、图片、字体颜色后执行刷新
*/
+ (void)updateTabBar;
/**
* @brief 根据identify更新tabbar
* @param identify tab注册的ID
*/
+ (void)updateTabBarWithID:(NSString *)identify;
@end
NS_ASSUME_NONNULL_END