BBATabBarController+Wrapper.h 3.21 KB
//
//  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