解决UINavigationController自定义返回键后没有侧滑返回效果的问题
来源:互联网 发布:java 大括号转义 编辑:程序博客网 时间:2024/05/16 06:55
解决UINavigationController自定义返回键后没有侧滑返回效果的问题
1.思路
用自定义的UINavigationController进行代理实现,其它地方的导航栏都要使用这个自定义的
2.代码实现
#import "DPMNavigationController.h"
@interface DPMNavigationController () <UINavigationControllerDelegate,UIGestureRecognizerDelegate>
@property (nonatomic,weak) UIViewController *viewController;
@end
@implementation DPMNavigationController
- (instancetype)initWithRootViewController:(UIViewController *)rootViewController {
DPMNavigationController *nav = [super initWithRootViewController:rootViewController];
nav.interactivePopGestureRecognizer.delegate =self;
nav.delegate =self;
return nav;
}
#pragma mark UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (1 == navigationController.viewControllers.count) {
self.viewController =nil;
} else {
self.viewController = viewController;
}
}
#pragma mark UIGestureRecognizerDelegate
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
if (gestureRecognizer == self.interactivePopGestureRecognizer) {
returnself.viewController ==self.topViewController;
}
return YES;
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if ([gestureRecognizer isKindOfClass:[UIPanGestureRecognizerclass]] && [otherGestureRecognizer isKindOfClass:[UIScreenEdgePanGestureRecognizerclass]]) {
return YES;
} else {
return NO;
}
}
@end
参考:http://www.bubuko.com/infodetail-790664.html
- 解决UINavigationController自定义返回键后没有侧滑返回效果的问题
- 彻底的自定义UINavigationController的返回键(左键)
- UINavigationController侧滑滑动返回 卡死问题
- 系统UINavigationController的返回
- UINavigationController 右滑返回
- UINavigationController的侧滑返回遇到的坑
- 解决io_service::run在没有任务就返回的问题
- UINavigationController返回手势失效问题
- UINavigationController返回手势失效问题
- UINavigationController返回手势失效问题
- UINavigationController返回手势失效问题
- UINavigationController返回手势失效问题
- UINavigationController返回手势失效问题
- ios UINavigationController右滑跨级返回问题
- UINavigationController&storyboard点击返回button时奔溃的问题
- 关于UINavigationController、UINavigationBar 中 navigationItem 左侧 “返回” 按钮的问题
- UINavigationController全屏右滑返回
- UINavigationController 自定义返回按钮导致返回手势失效解决办法
- PHP日期和时间
- 【Unity3D】【Shader】UGUI上Logo闪光效果
- 软件开发工具
- 螺旋队列
- 正则表达式 验证手机号码和邮箱输入是否正确
- 解决UINavigationController自定义返回键后没有侧滑返回效果的问题
- 程序员的自我提升
- Unity 5.0 无法通过GUIText类型在脚本中调用画布中的Text文字
- MP3信息
- Android实现在横竖屏切换时信息保留不会丢失
- Java:IO流的一些典型例子
- 【Android Studio】深入探究webView的缓存机制
- Linode VPS
- vs2010 问题 >LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏