如何禁用UINavigation Controller的滑动手势

时间:2015-11-24 08:36:11

标签: ios uinavigationcontroller ios9

在App代表中:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];


    WalkThrough  *viewControllers=[[WalkThrough alloc]init];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewControllers];



[self.window setRootViewController:self.navigationController];
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
navigationController.navigationBar.hidden = YES;
self.window.backgroundColor = [UIColor clearColor];
[self.window makeKeyAndVisible];

return YES;
}

1 个答案:

答案 0 :(得分:0)

尝试在 [window makeKeyAndVisible]之后停用interactivePopGestureRecognizer

问题的关键是interactivePopGestureRecognizer属性为nil,直到 两者 满足两个条件:

  1. navigationController与窗口

  2. 相关联
  3. 窗口变为关键且可见