Giter VIP home page Giter VIP logo

Comments (4)

macbookpro2100 avatar macbookpro2100 commented on June 7, 2024 1

一,NavigationViewController滑动时屏蔽tabBar响应

里面层customviewWillAppear时 [self.rdv_tabBarController.tabBar setUserInteractionEnabled:NO];
里面层viewDidAppear时[self.rdv_tabBarController.tabBar setUserInteractionEnabled:YES];

add UIViewController+Swizzle.h
#import <UIKit/UIKit.h>
@interface UIViewController (Swizzle)
@end
void swizzleAllViewController();

add UIViewController+Swizzle.m
#import "UIViewController+Swizzle.h"
#import <RDVTabBarController/RDVTabBarController.h>

@implementation UIViewController (Swizzle)
- (void)customViewDidAppear:(BOOL)animated {

    [self.rdv_tabBarController.tabBar setUserInteractionEnabled:YES];
    [self customViewDidAppear:animated];
}

- (void)customViewWillDisappear:(BOOL)animated {
    [self customViewWillDisappear:animated];
}

- (void)customviewWillAppear:(BOOL)animated {
    [self.rdv_tabBarController.tabBar setUserInteractionEnabled:NO];
    [self customviewWillAppear:animated];
}


+ (void)load {
    swizzleAllViewController();
}
@end

void swizzleAllViewController() {
    Swizzle([UIViewController class], @selector(viewDidAppear:), @selector(        customViewDidAppear:));
    Swizzle([UIViewController class], @selector(viewWillDisappear:), @selector(        customViewWillDisappear:));
    Swizzle([UIViewController class], @selector(viewWillAppear:), @selector(        customviewWillAppear:));
}

// 方法交换
void Swizzle(Class claz, SEL originalSelector, SEL swizzledSelector)
{

Method originalMethod = class_getInstanceMethod(claz, originalSelector);
Method swizzledMethod = class_getInstanceMethod(claz, swizzledSelector);


BOOL didAddMethod =
class_addMethod(claz,
                originalSelector,
                method_getImplementation(swizzledMethod),
                method_getTypeEncoding(swizzledMethod));

if (didAddMethod){
    class_replaceMethod(claz,
                        swizzledSelector,
                        method_getImplementation(originalMethod),
                        method_getTypeEncoding(originalMethod));
} else {
    method_exchangeImplementations(originalMethod, swizzledMethod);
}

}

二 ,push hiden tabbar 参照Coding方案

from rdvtabbarcontroller.

Homosum avatar Homosum commented on June 7, 2024

我也是这个问题,so do I

from rdvtabbarcontroller.

AlwaysYang avatar AlwaysYang commented on June 7, 2024

在push 的页面 viewdidappear 里面,隐藏tabbar

from rdvtabbarcontroller.

litianzhu818 avatar litianzhu818 commented on June 7, 2024

I think you had used the RDVTabBarController in the wrong way. you should use RDVTabBarController like this:

UIViewController *viewController1 = [UIViewController new];
UIViewController *viewController2 = [UIViewController new];
UIViewController *viewController3 = [UIViewController new];
UIViewController *viewController4 = [UIViewController new];

RDVTabBarViewController *tabBarViewController = [RDVTabBarViewController new];
[tabBarViewController setViewControllers:@[viewController1, viewController2, viewController3, viewController4]];
										 
UINavigationViewController *rootNavigationController = [[UINavigationViewController alloc] initWithRootViewController:tabBarViewController];									  

......

self.window.rootViewController = rootNavigationController;

not like this:

UIViewController *viewController1 = [UIViewController new];
UIViewController *viewController2 = [UIViewController new];
UIViewController *viewController3 = [UIViewController new];
UIViewController *viewController4 = [UIViewController new];

UINavigationViewController *navigationController1 = [[UINavigationViewController alloc] initWithRootViewController:viewController1];
UINavigationViewController *navigationController2 = [[UINavigationViewController alloc] initWithRootViewController:viewController2];
UINavigationViewController *navigationController3 = [[UINavigationViewController alloc] initWithRootViewController:viewController3];
UINavigationViewController *navigationController4 = [[UINavigationViewController alloc] initWithRootViewController:viewController4];

RDVTabBarViewController *tabBarViewController = [RDVTabBarViewController new];
[tabBarViewController setViewControllers:@[navigationController1, navigationController2, navigationController3, navigationController4]];
										  
......

self.window.rootViewController = tabBarViewController;

from rdvtabbarcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.