bryankeller/BLKFlexibleHeightBar

Starting to scroll from the bar

LucasAdam opened this issue · 4 comments

Hello,

First of all great library ! That being said, would it be possible to start the process of stretching the bar, as you start scrolling from that bar itself. I hope you get me, now it only works (at least for me) if i start scrolling from what's below my bar, not from the bar itself.

Thanks :)

I'm not sure if I completely understand your issue, but I'll take a guess. Setting userInteractionEnabled to NO on the BLKFlexibleHeightBar instance will allows touches to pass through to your scroll view. Let me know if this fixes it for you!

It does indeed work using userInteractionEnabled set to NO. But the thing is, I actually need the interactions enabled on my bar because I do stuff according to these interactions. Anyway, nothing much you can do I guess. Thanks ;)

You should be able to implement some custom logic for that by subclassing BLKFlexibleHeightBar and doing your own hit tests. It might actually be wise for this functionality to be built in since I imagine many people would like it to behave this way.

implementing that is fair easy:

  • following this scenario you have a tableview with many rows and you have your custom flexible header.
  1. add top inset equal to your flexibleHeader height to your tableView.
  2. place your custom flexibleHeader below your tableView so CFH can be visible beneath tableView
    now when you swipe you finger on CFH you are actually swiping on the tableView
  • second scenario: you have a custom view in you CFH which contains some buttons imagine a custom navBar with a back button inside your CFH:
  1. add - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event to your custom flexibleHeader
  2. implement this way:
if (CGRectContainsPoint(self.navBar.bounds, point))
    {
       targetView targetView = self.navBar;
        // The target view may have its view hierarchy,
        // so call its hitTest method to return the right hit-test view which cause touch forwarded to navBar buttons
        UIView *finalView = [targetView hitTest:point withEvent:event];

        return finalView;
    }
    return [super hitTest:point withEvent:event];