80 lines
2.8 KiB
Objective-C
80 lines
2.8 KiB
Objective-C
//
|
|
// QXBaseNavigationController.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/4/24.
|
|
//
|
|
|
|
#import "QXBaseNavigationController.h"
|
|
|
|
@interface QXBaseNavigationController ()<UINavigationControllerDelegate,UIGestureRecognizerDelegate>
|
|
|
|
@end
|
|
|
|
@implementation QXBaseNavigationController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
// Do any additional setup after loading the view.
|
|
self.interactivePopGestureRecognizer.delegate = self;
|
|
self.delegate = self;
|
|
}
|
|
-(void)viewWillAppear:(BOOL)animated{
|
|
[super viewWillAppear:animated];
|
|
}
|
|
|
|
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
|
|
if (self.viewControllers.count == 1) {
|
|
viewController.hidesBottomBarWhenPushed = YES;
|
|
}
|
|
// if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
|
|
// self.interactivePopGestureRecognizer.enabled = YES;
|
|
// }
|
|
[super pushViewController:viewController animated:animated];
|
|
}
|
|
//-(UIViewController *)popViewControllerAnimated:(BOOL)animated{
|
|
// if (self.childViewControllers.count == 2) {
|
|
// if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
|
|
// self.interactivePopGestureRecognizer.enabled = YES;
|
|
// }
|
|
// }
|
|
// return [super popViewControllerAnimated:animated];
|
|
//}
|
|
-(void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
|
|
if (self.childViewControllers.count > 1) {
|
|
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
|
|
if ([self.visibleViewController isKindOfClass:NSClassFromString(@"QXRoomViewController")] || [self.visibleViewController isKindOfClass:NSClassFromString(@"QXChirldViewController")]) {
|
|
self.interactivePopGestureRecognizer.enabled = NO;
|
|
}else{
|
|
self.interactivePopGestureRecognizer.enabled = YES;
|
|
}
|
|
}
|
|
}else{
|
|
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
|
|
self.interactivePopGestureRecognizer.enabled = NO;
|
|
}
|
|
}
|
|
}
|
|
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
|
|
return YES;
|
|
}
|
|
|
|
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
|
|
if (self.viewControllers.count == 1) {
|
|
return NO;
|
|
}
|
|
return YES;
|
|
}
|
|
|
|
/*
|
|
#pragma mark - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
|
// Get the new view controller using [segue destinationViewController].
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
@end
|