ios7禁止默认划动返回

 self.navigationController.interactivePopGestureRecognizer.enabled = NO;ios

spa

在使用以前先要判断是否ios7,否则会致使crash。而后建立一个本身的navigationController继承UINavigationController。以后还要设置UINavigationControllerDelegate,这样以上的方法才能触发。最后就判断要show出来的viewController是否须要支持划动返回了。

 

 

 

 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animatedcode

{
     if ([ self respondsToSelector : @selector (interactivePopGestureRecognizer)]) {
         if (viewController .class == [ MyViewController class ])
         {
             self .interactivePopGestureRecognizer .enabled = NO ;
         } else {
             self .interactivePopGestureRecognizer .enabled = YES ;
         }
     }
}
相关文章
相关标签/搜索