I have a standard UINavigationViewController with a standard UIInteractivePopGestureRecognizer for iOS 7. I also have these well known and widely-used methods:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
They work like this:
- (void)keyboardWillShow:(NSNotification *)notification{
    CGFloat keyboardSlideDuration = [[[notification userInfo] objectForKey: UIKeyboardAnimationDurationUserInfoKey] floatValue];
    UIViewAnimationOptions keyboardAnimationCurve = [[notification userInfo][UIKeyboardAnimationCurveUserInfoKey] integerValue]<<16;
    if (keyboardIsUp || isAnimating) return;
    isAnimating = YES;
    [UIView animateWithDuration:keyboardSlideDuration delay:0 options:(keyboardAnimationCurve | UIViewAnimationOptionBeginFromCurrentState) animations:^{
        _topConstraint.constant -= kTopConstraintR4Ratio;
        [self.view layoutIfNeeded];
    }completion:^(BOOL finished){
        keyboardIsUp = YES;
        isAnimating = NO;
    }];
}
- (void)keyboardWillHide:(NSNotification *)notification{
    CGFloat keyboardSlideDuration = [[[notification userInfo] objectForKey: UIKeyboardAnimationDurationUserInfoKey] floatValue];
    UIViewAnimationOptions keyboardAnimationCurve = [[notification userInfo][UIKeyboardAnimationCurveUserInfoKey] integerValue]<<16;
    if (isAnimating) return;
    isAnimating = YES;
    [UIView animateWithDuration:keyboardSlideDuration delay:0 options:(keyboardAnimationCurve | UIViewAnimationOptionBeginFromCurrentState) animations:^{
        _topConstraint.constant = topConstraintOriginalValue;
        [self.view layoutIfNeeded];
    } completion:^(BOOL finished) {
        keyboardIsUp = NO;
        isAnimating = NO;
    }];
}
The thing is that UIView animateWithDuration is triggered without any respect to duration when I swipe the view back with a gesture. The whole view turns into a mess - it animates slowly when I pop the view, but when the gesture isn't finished - the view jumps up.
It looks like this:

How do I get rid of this strange behavior? I don't want the view to move during the transition and I want it to stay still.
EDIT:
You can download the sample project using the link here:
 
     
     
    