2016-07-21 76 views
0

我有一個自定義導航控制器,聲明如下。我的問題是,一旦我執行此操作,返回到前一個堆棧(interactivepopgesturerecognizer)的後滑動手勢不起作用。我如何啓用它?我的應用中有很多視圖控制器。謝謝。使用自定義導航控制器時啓用回手勢滑動手勢

#import "NavController.h" 

    @interface NavController() 
    { 
     BOOL shouldIgnorePushingViewControllers; 
    } 

    @end 

    @implementation NavController 

    -(instancetype)init { 
     self = [super init]; 
     self.delegate=self; 

     return self; 

    } 

    -(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated 
    { 
     if (!shouldIgnorePushingViewControllers) 
     { 
      [super pushViewController:viewController animated:animated]; 
     } 

     shouldIgnorePushingViewControllers = YES; 
    } 

    - (void)didShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
    { 
     shouldIgnorePushingViewControllers = NO; 
    } 

    @end 
+0

一個暗示這裏http://stackoverflow.com/a/23604864/1463604 – Nishant

回答

0

嘗試啓用財產

self.interactivePopGestureRecognizer.enabled = YES;

init方法