Files
featherVoice/QXLive/Base/QXBaseNavigationController.m

80 lines
2.8 KiB
Mathematica
Raw Normal View History

2025-08-08 10:49:36 +08:00
//
// 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)]) {
2025-10-20 09:43:10 +08:00
if ([self.visibleViewController isKindOfClass:NSClassFromString(@"QXRoomViewController")] || [self.visibleViewController isKindOfClass:NSClassFromString(@"QXChirldViewController")]) {
2025-08-08 10:49:36 +08:00
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