Comments (14)
pop放主线程即可
// WRNavigationBar.m
// - (BOOL)navigationBar: shouldPopItem: 方法
dispatch_async(dispatch_get_main_queue(), ^{
[self popToViewController:popToVC animated:YES];
});
from wrnavigationbar.
同问
from wrnavigationbar.
请问楼上的解决了么?
from wrnavigationbar.
同问
from wrnavigationbar.
在iOS 13上,[self popViewControllerAnimated:YES];
这句就不要执行了,可以这么写:
if (!@available(iOS 13.0, *)) { [self popViewControllerAnimated:YES]; }
from wrnavigationbar.
同问
from wrnavigationbar.
pop放主线程即可
// WRNavigationBar.m // - (BOOL)navigationBar: shouldPopItem: 方法 dispatch_async(dispatch_get_main_queue(), ^{ [self popToViewController:popToVC animated:YES]; });
确实好使,非常感谢
from wrnavigationbar.
有没有彻底解决这个问题的?
from wrnavigationbar.
有 全局搜索 - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item 这个方法 iOS 13需要单独在处理 如果没有特殊需求 直接返回yes
from wrnavigationbar.
`- (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.
第一种可以用...
from wrnavigationbar.
pop放主线程即可
// WRNavigationBar.m // - (BOOL)navigationBar: shouldPopItem: 方法 dispatch_async(dispatch_get_main_queue(), ^{ [self popToViewController:popToVC animated:YES]; });
这样做的具体原因是什么
from wrnavigationbar.
pop放主线程即可
// WRNavigationBar.m // - (BOOL)navigationBar: shouldPopItem: 方法 dispatch_async(dispatch_get_main_queue(), ^{ [self popToViewController:popToVC animated:YES]; });
为什么这样做
from wrnavigationbar.
感谢dispatch_async
from wrnavigationbar.
Related Issues (20)
- 既然已经不维护建议标记为deprecated,个人目前不建议使用 HOT 5
- 作者导航栏高度怎么改都没用,怎么办!!!!!! HOT 1
- isIPhoneX 判断条件错误 HOT 2
- 鉴于作者已经两年不更新了, 本人阅读源码后自己写了一个类似的库, 欢迎尝试
- push到下一个控制器 pop回来是导航栏出现短暂的白色 过一秒恢复正常是为什么? HOT 2
- 这么好用的库怎么就不维护了呢 HOT 1
- 您好,请问如何设置左右两侧多按钮呢?
- 按网上说的修改支持iPhone 11pro max等机型没问题,但是iphone 12 mini 显示有问题 HOT 1
- 测试IQKeyboard的问题 HOT 3
- 请问下不同界面不同高度的导航档也能用实个框架实现吗? HOT 1
- wr_setBackgroundColor 逻辑问题
- WRCustomNavigationBar支持添加多个item[Enhancement]
- 什么时候适配下暗黑模式?
- Demo中设置状态栏样式不生效
- Keyboard toolBar frame issues when UIDeviceOrientation value changed
- 转场动画与wrPopProgress计算问题 HOT 1
- 设置wr_setNavBarBackgroundAlpha=0无效
- 需要适配"灵动岛(dynamic island)" HOT 1
- 需要适配“灵动岛(dynamic island)”
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wrnavigationbar.