iOS开发-iOS7禁用手势返回

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    // 禁用 iOS7 返回手势
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    // 开启
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
}

  

posted @ 2015-08-20 10:20  feiling  阅读(320)  评论(0编辑  收藏  举报