Code Monkey home page Code Monkey logo

Comments (14)

dte2mdj avatar dte2mdj commented on May 27, 2024 5

pop放主线程即可

//    WRNavigationBar.m
//   - (BOOL)navigationBar: shouldPopItem: 方法
dispatch_async(dispatch_get_main_queue(), ^{
        [self popToViewController:popToVC animated:YES];
});

from wrnavigationbar.

miaoruiyuan avatar miaoruiyuan commented on May 27, 2024

同问

from wrnavigationbar.

Mac-sir avatar Mac-sir commented on May 27, 2024

请问楼上的解决了么?

from wrnavigationbar.

CQxiaogang avatar CQxiaogang commented on May 27, 2024

同问

from wrnavigationbar.

kasumar avatar kasumar commented on May 27, 2024

在iOS 13上,[self popViewControllerAnimated:YES]; 这句就不要执行了,可以这么写:
if (!@available(iOS 13.0, *)) { [self popViewControllerAnimated:YES]; }

from wrnavigationbar.

IIIOS avatar IIIOS commented on May 27, 2024

同问

from wrnavigationbar.

MrStock007 avatar MrStock007 commented on May 27, 2024

pop放主线程即可

//    WRNavigationBar.m
//   - (BOOL)navigationBar: shouldPopItem: 方法
dispatch_async(dispatch_get_main_queue(), ^{
        [self popToViewController:popToVC animated:YES];
});

确实好使,非常感谢

from wrnavigationbar.

yjjwxq avatar yjjwxq commented on May 27, 2024

有没有彻底解决这个问题的?

from wrnavigationbar.

miaoruiyuan avatar miaoruiyuan commented on May 27, 2024

有 全局搜索 - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item 这个方法 iOS 13需要单独在处理 如果没有特殊需求 直接返回yes

from wrnavigationbar.

miaoruiyuan avatar miaoruiyuan commented on May 27, 2024

`- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item {

if (@available(iOS 13.0, *)) {
    return YES;
}
id<UIViewControllerTransitionCoordinator> transitionCoordinator = self.topViewController.transitionCoordinator;
if (transitionCoordinator && transitionCoordinator.initiallyInteractive) {
    // 滑动手势
    if (@available(iOS 10.0, *)) {
        [transitionCoordinator notifyWhenInteractionChangesUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
            [self dealInteractionChangesWithContext:context];
        }];
    } else {
        [transitionCoordinator notifyWhenInteractionChangesUsingBlock:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
            [self dealInteractionChangesWithContext:context];
        }];
    }
} else {
    
    
    
    
    BOOL shouldPop = YES;
    UIViewController* vc = [self topViewController];
    if([vc respondsToSelector:@selector(navigationShouldPopOnBackButton)]) {
        shouldPop = [vc navigationShouldPopOnBackButton];
        if(shouldPop) {
            NSInteger idx = self.viewControllers.count >= self.navigationBar.items.count ? 2 : 1;
            UIViewController *popToVC = self.viewControllers[self.viewControllers.count - idx];
            
            [self popToViewController:popToVC animated:YES];
        }else{
            return NO;
        }
    }else{
        NSInteger idx = self.viewControllers.count >= self.navigationBar.items.count ? 2 : 1;
        UIViewController *popToVC = self.viewControllers[self.viewControllers.count - idx];
        
        [self popToViewController:popToVC animated:YES];
    }
    
}
return YES;

}`

from wrnavigationbar.

XuYoujin avatar XuYoujin commented on May 27, 2024

第一种可以用...

from wrnavigationbar.

changpk avatar changpk commented on May 27, 2024

pop放主线程即可

//    WRNavigationBar.m
//   - (BOOL)navigationBar: shouldPopItem: 方法
dispatch_async(dispatch_get_main_queue(), ^{
        [self popToViewController:popToVC animated:YES];
});

这样做的具体原因是什么

from wrnavigationbar.

FireG avatar FireG commented on May 27, 2024

pop放主线程即可

//    WRNavigationBar.m
//   - (BOOL)navigationBar: shouldPopItem: 方法
dispatch_async(dispatch_get_main_queue(), ^{
        [self popToViewController:popToVC animated:YES];
});

为什么这样做

from wrnavigationbar.

danmingyang avatar danmingyang commented on May 27, 2024

感谢dispatch_async

from wrnavigationbar.

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.