cdts/xdts-ios 3/TreeHole/CYHResetCode/CYH/QMUIKit/QMUIMainFrame/QMUINavigationController.h

181 lines
11 KiB
C
Raw Permalink Normal View History

2023-07-27 09:20:00 +08:00
/**
* Tencent is pleased to support the open source community by making QMUI_iOS available.
* Copyright (C) 2016-2021 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
* http://opensource.org/licenses/MIT
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
//
// QMUINavigationController.h
// qmui
//
// Created by QMUI Team on 14-6-24.
//
#import <UIKit/UIKit.h>
@interface QMUINavigationController : UINavigationController
@end
@interface QMUINavigationController (UISubclassingHooks)
/**
* Controller在即将展示的时候被调用`UINavigationController``navigationController:willShowViewController:animated:`dismiss后回来此时并不会调用`navigationController:willShowViewController``viewWillAppear`
*/
- (void)willShowViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated NS_REQUIRES_SUPER;
/**
*
*/
- (void)didShowViewController:(nonnull UIViewController *)viewController animated:(BOOL)animated NS_REQUIRES_SUPER;
@end
/// 与 QMUINavigationController push/pop 相关的一些方法
@protocol QMUINavigationControllerTransitionDelegate <NSObject>
@optional
/**
* gestureRecognizer.state viewController
* @param navigationController QMUINavigationController vc.navigationController nav
* @param gestureRecognizer
* @param viewControllerWillDisappear vc
* @param viewControllerWillAppear vc
*/
- (void)navigationController:(nonnull QMUINavigationController *)navigationController
poppingByInteractiveGestureRecognizer:(nullable UIScreenEdgePanGestureRecognizer *)gestureRecognizer
viewControllerWillDisappear:(nullable UIViewController *)viewControllerWillDisappear
viewControllerWillAppear:(nullable UIViewController *)viewControllerWillAppear DEPRECATED_MSG_ATTRIBUTE("不便于判断手势返回是否成功,请使用 navigationController:poppingByInteractiveGestureRecognizer:isCancelled:viewControllerWillDisappear:viewControllerWillAppear: 代替");
/**
* gestureRecognizer.state viewController
* @param navigationController QMUINavigationController vc.navigationController UINavigationController vc.navigationController nil
* @param gestureRecognizer
* @param isCancelled
* @param viewControllerWillDisappear vc pop
* @param viewControllerWillAppear vc
*/
- (void)navigationController:(nonnull QMUINavigationController *)navigationController
poppingByInteractiveGestureRecognizer:(nullable UIScreenEdgePanGestureRecognizer *)gestureRecognizer
isCancelled:(BOOL)isCancelled
viewControllerWillDisappear:(nullable UIViewController *)viewControllerWillDisappear
viewControllerWillAppear:(nullable UIViewController *)viewControllerWillAppear;
/**
* self.navigationController 4 viewController willPopInNavigationControllerWithAnimated:
* 1. popViewControllerAnimated:
* 2. popToViewController:animated:
* 3. popToRootViewControllerAnimated:
* 4. setViewControllers:animated:
*
* self self.navigationController.viewControllers
*
* ARC viewController autorelease viewController pop后不一定立即被销毁dealloc内
*
* @warning willPopInNavigationControllerWithAnimated: viewController pop 使
*/
- (void)willPopInNavigationControllerWithAnimated:(BOOL)animated;
/**
* self.navigationController 4 viewController didPopInNavigationControllerWithAnimated:
* 1. popViewControllerAnimated:
* 2. popToViewController:animated:
* 3. popToRootViewControllerAnimated:
* 4. setViewControllers:animated:
*
* self.navigationController self viewControllers
*
* @warning self pop self viewControllers
*/
- (void)didPopInNavigationControllerWithAnimated:(BOOL)animated;
/**
* setViewControllers:animated: viewController viewControllers.lastObject self.viewControllers.lastObject viewController viewWillAppear:viewDidAppear:
*/
- (void)viewControllerKeepingAppearWhenSetViewControllersWithAnimated:(BOOL)animated;
@end
/// 与 QMUINavigationController 外观样式相关的方法
@protocol QMUINavigationControllerAppearanceDelegate <NSObject>
@optional
/// 设置 titleView 的 tintColor
- (nullable UIColor *)qmui_titleViewTintColor;
/// 设置导航栏的背景图,默认为 NavBarBackgroundImage
- (nullable UIImage *)qmui_navigationBarBackgroundImage;
/// 设置导航栏底部的分隔线图片,默认为 NavBarShadowImage必须在 navigationBar 设置了背景图后才有效(系统限制如此)
- (nullable UIImage *)qmui_navigationBarShadowImage;
/// 设置当前导航栏的 barTintColor默认为 NavBarBarTintColor
- (nullable UIColor *)qmui_navigationBarBarTintColor;
/// 设置当前导航栏的 barStyle默认为 NavBarStyle
- (UIBarStyle)qmui_navigationBarStyle;
/// 设置当前导航栏的 UIBarButtonItem 的 tintColor默认为NavBarTintColor
- (nullable UIColor *)qmui_navigationBarTintColor;
/// 设置系统返回按钮title如果返回nil则使用系统默认的返回按钮标题。当实现了这个方法时会无视配置表 NeedsBackBarButtonItemTitle 的值
- (nullable NSString *)qmui_backBarButtonItemTitleWithPreviousViewController:(nullable UIViewController *)viewController;
@end
/// 与 QMUINavigationController 控制 navigationBar 显隐/动画相关的方法
@protocol QMUICustomNavigationBarTransitionDelegate <NSObject>
@optional
/// 设置每个界面导航栏的显示/隐藏,为了减少对项目的侵入性,默认不开启这个接口的功能,只有当 shouldCustomizeNavigationBarTransitionIfHideable 返回 YES 时才会开启此功能。如果需要全局开启,那么就在 Controller 基类里面返回 YES如果是老项目并不想全局使用此功能那么则可以在单独的界面里面开启。
- (BOOL)preferredNavigationBarHidden;
/**
* shouldCustomizeNavigationBarTransitionIfHideable viewWillAppear viewWillDisappear
* @see UINavigationController+NavigationBarTransition.h
* @see preferredNavigationBarHidden
*/
- (BOOL)shouldCustomizeNavigationBarTransitionIfHideable;
/**
* 使 push / pop transition <br/>
* controller key <br/>
* nil使<br/>
* @warning shouldCustomNavigationBarTransitionxxx 使
* @see UINavigationController+NavigationBarTransition.h
* @see AutomaticCustomNavigationBarTransitionStyle
*/
- (nullable NSString *)customNavigationBarTransitionKey;
/**
* 使 QMUI push / pop transition 使 vc YES 使
* @see UINavigationController+NavigationBarTransition.h
*/
- (BOOL)shouldCustomizeNavigationBarTransitionIfUsingCustomTransitionForOperation:(UINavigationControllerOperation)operation fromViewController:(nullable UIViewController *)fromVC toViewController:(nullable UIViewController *)toVc;
/**
* navBar效果过程中UINavigationController的containerView的背景色
* @see UINavigationController+NavigationBarTransition.h
*/
- (nullable UIColor *)containerViewBackgroundColorWhenTransitioning;
@end
/**
* QMUINavigationController 使 navController UIViewController
* QMUICommonViewControllerQMUICommonTableViewController
*/
@protocol QMUINavigationControllerDelegate <UINavigationControllerDelegate, QMUINavigationControllerTransitionDelegate, QMUINavigationControllerAppearanceDelegate, QMUICustomNavigationBarTransitionDelegate>
@end