Search code examples
ios8show-hideuiswipegesturerecognizer

New 'hideBarsOnSwipe' IOS 8 method affects other view objects


I have been playing around with the new navigationcontroller.hideBarsOnSwipe method and it is really awesome! However, the big downside seems to be that it affects ALL UIView objects in the visible view. To be more presice: when I have a label overlapping my scrollvie/tableview, it recognizes the 'Swipe' gesture and moves the entire view up - would anybody have an idea how to only make this gesture affect the underlying tableview? Thanks!


Solution

  • So the way to fix this in a easy manner, is simply disabling the swipe gesture for certain objects by looking at the recognizer of the object using the following:

    - (BOOL)gestureRecognizer:(UISwipeGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    
    if( [gestureRecognizer view] == self.(your view object) {
        return NO;
        }
    return YES;
    

    }

    additionally, you can turn the gesture to false or true depending on what popups are open.