IOS7新特性-右滑返回上级页面

添加委托  UIGestureRecognizerDelegate

- (void)viewWillAppear:(BOOL)animated
{

    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
        self.navigationController.interactivePopGestureRecognizer.delegate = self;
    }
}
委托
 
  
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{

    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        if ( gestureRecognizer == self.navigationController.interactivePopGestureRecognizer) {
             return NO;
        }
    }
    return YES;
}


 
  

你可能感兴趣的:(ios,Object-c)