Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting to scroll from the bar #45

Open
LucasAdam opened this issue Sep 2, 2015 · 4 comments
Open

Starting to scroll from the bar #45

LucasAdam opened this issue Sep 2, 2015 · 4 comments

Comments

@LucasAdam
Copy link

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 :)

@bryankeller
Copy link
Owner

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!

@LucasAdam
Copy link
Author

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 ;)

@bryankeller
Copy link
Owner

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.

@haashem
Copy link

haashem commented Oct 28, 2015

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];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants