interactivePopGestureRecognizer是iOS7推出的解决VeiwController滑动后退的新功能,虽然很实用,但是坑也很多啊,用过的同学肯定知道问题在哪里,所以具体问题我就不描述了,这里只给出如何完美解决interactivePopGestureRecognizer卡住的问题.

当然我们要自定义UINavigationController来解决这个问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#import "MMNavController.h"

@interface MMNavController ()
{ } @end @implementation MMNavController - (id)initWithRootViewController:(UIViewController *)rootViewController
{
self = [super initWithRootViewController:rootViewController];
if (self) {
// Custom initialization }
return self;
} - (void)viewDidLoad
{ __weak MMNavController *weakSelf = self; if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.interactivePopGestureRecognizer.delegate = weakSelf; self.delegate = weakSelf;
} } - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{ if ( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] && animated == YES )
{
self.interactivePopGestureRecognizer.enabled = NO;
} [super pushViewController:viewController animated:animated]; } - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated
{
if ( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] && animated == YES )
{
self.interactivePopGestureRecognizer.enabled = NO;
} return [super popToRootViewControllerAnimated:animated]; } - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if( [self respondsToSelector:@selector(interactivePopGestureRecognizer)] )
{
self.interactivePopGestureRecognizer.enabled = NO;
} return [super popToViewController:viewController animated:animated]; } #pragma mark UINavigationControllerDelegate - (void)navigationController:(UINavigationController *)navigationController
didShowViewController:(UIViewController *)viewController
animated:(BOOL)animate
{
if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)])
{
self.interactivePopGestureRecognizer.enabled = YES;
}
} -(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{ if ( gestureRecognizer == self.interactivePopGestureRecognizer )
{
if ( self.viewControllers.count < 2 || self.visibleViewController == [self.viewControllers objectAtIndex:0] )
{
return NO;
}
} return YES;
}
@end

iOS 完美解决 interactivePopGestureRecognizer 卡住的问题的更多相关文章

  1. ios侧滑返回:完美解决 interactivePopGestureRecognizer 卡住的问题

    interactivePopGestureRecognizer是iOS7推出的解决VeiwController滑动后退的新功能,虽然很实用,但是坑也很多啊(比如在rootViewcontroller下 ...

  2. 2017-04-26 ios ipv6那些事(已完美解决)

    2017-04-26 ios ipv6那些事(已完美解决)   工作单位性质属于外包公司,每天都有几十的app要提交上传至应用市场,于2017年3月份接到ios工程师反馈 Guideline 2.1 ...

  3. win10想说爱你不容易——安装.net3.5也是一个坑(已有完美解决方法)

    最终完美解决方法:经过多次波折,终于找到无法正常安装.net3.5的原因了,是因为已删除的用户还有注册表残留导致的,而且这个问题还会影响一个win10更新的安装,导致每天更新失败,撤销更新... 详见 ...

  4. 完美解决windows10磁盘占用100%并出现卡顿、假死无反应

    完美解决windows10磁盘占用100%并出现卡顿.假死无反应 想必大家也跟我一样,自从用win10系统以后经常会出现这种情况:磁盘突然占用100%然后开始出现假死现象,电脑卡住,点击任何软件没反应 ...

  5. 完美解决,浏览器下拉显示网址问题 | 完美解决,使用原生 scroll 写下拉刷新

    在 web 开发过程中我们经常遇到,不想让用户下拉看到我的地址,也有时候在 div 中没有惯性滚动,就此也出了 iScroll 这种关于滚动条的框架,但是就为了一个体验去使用一个框架好像又不值得,今天 ...

  6. 完美解决IE(IE6/IE7/IE8)不兼容HTML5标签的方法

    完美解决IE(IE6/IE7/IE8)不兼容HTML5标签的方法   HTML5的语义化标签以及属性,可以让开发者非常方便地实现清晰的web页面布局,加上CSS3的效果渲染,快速建立丰富灵活的web页 ...

  7. 完美解决 Linux 下 Sublime Text 中文输入

    首先,我参考了好几篇文章,都是蛮不错的,先列出来: sublime-text-imfix:首先推荐这个方法,最简单,但是在我的系统上有些问题.可用这个的强烈推荐用这个 完美解决 Linux 下 Sub ...

  8. Linux安装软件时缺少依赖包的简单较完美解决方法!

    大家在linux下源码安装时,有木有经常碰到缺少这个包那个包的,然后不知所措?看到最近有几个筒子安装thrift,安装python因缺少依赖包而进行不下去了.我用的是红帽,装系统的时候习惯把所有的有的 ...

  9. MacBook Pro/Air 下使用 linux ubuntu 系统 波浪号“~”变成其他 符号 的完美解决办法

    打开终端,输入: sudo su - > /sys/module/hid_apple/parameters/iso_layout sudo su -需要root权限,所以使用前请注意已下载roo ...

随机推荐

  1. storm分组模式

    Shuffle grouping: Tuples被随机分配到每一个bolt’s task,以便于每一个bolt’s task获得相同数量的tuples. Fields grouping: Stream ...

  2. UVAoj 11324 - The Largest Clique(tarjan + dp)

    题意:给定一个有向图,寻找一个点数最大集合,使得这个集合中的任意两个点 u,v, 都有u->v 或者 v->u 或者u<==>v 思路:首先将强连通分量通过tarjan算法求出 ...

  3. LeetCode——Merge k Sorted Lists

    Discription: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its ...

  4. 敏捷个人微信号:AgileMe ,欢迎大家推广和关注

  5. 非聚集索引中的临界点(Tipping Point)

    什么是临界点? 注意,我要说的问题是非聚集索引的执行计划从Seek+Lookup变成Table/Clustered Index Scan的临界点.SQL Server的访问数据的IO最小单元是页. 我 ...

  6. LRU Cache

    LRU Cache 题目链接:https://oj.leetcode.com/problems/lru-cache/ Design and implement a data structure for ...

  7. Greedy --- HNU 13320 Please, go first

    Please, go first Problem's Link: http://acm.hnu.cn/online/?action=problem&type=show&id=13320 ...

  8. CSS控制文本超出指定宽度显示省略号和文本不换行

    一般的文字截断(适用于内联与块): .text-overflow { display:block;/*内联对象需加 */ width:31em;/* 何问起 hovertree.com */ word ...

  9. SignalR-支持平台

    1.支持的服务器操作系统: SignalR 服务器组件可以驻留在下列服务器或客户端操作系统.请注意, SignalR 使用 Websocket,为 Windows Server 2012 或 Wind ...

  10. Qt 框架 开发HTTP 服务器 开发记录

    最近需求需要开发一款 HTTP ,然后由于先前接触过Qt,就直接用Qt写HTTP服务器了,也是为了当作练手,要不然是直接上HTTP框架的. 后端用C++ Qt框架 前端为了练手 当然是纯生的 js h ...