ios - 如何在 iOS9 中禁用 interactivePopGestureRecognizer 禁用
<p><p>我需要在我的应用程序中禁用 interactivePopGestureRecognizer,我做到了</p>
<pre><code>- (void)viewDidAppear:(BOOL)animated
{
;
// Disable iOS 7 back gesture
if ()
{
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
self.navigationController.interactivePopGestureRecognizer.delegate = self;
}
}
- (void)viewWillDisappear:(BOOL)animated
{
;
// Enable iOS 7 back gesture
if ()
{
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
self.navigationController.interactivePopGestureRecognizer.delegate = nil;
}
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
return NO;
}
</code></pre>
<p>它适用于“iOS8”,我在“iOS9”上有一个问题。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>如果你想全局禁用interactivePopGestureRecognizer,你可以在如下创建navigationController后禁用它。</p>
<pre><code>UINavigationController *nav = [ initWithRootViewController:rootVC];
nav.interactivePopGestureRecognizer.enabled=NO;
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如何在 iOS9 中禁用 interactivePopGestureRecognizer 禁用,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/34449037/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/34449037/
</a>
</p>
页:
[1]