What I have is this in the viewDidLoad
:
UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(hideHeaderBar:)];
swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
swipeUp.
[self.view addGestureRecognizer:swipeUp];
And then I have a UIScrollView
in the view. For some reason when I scroll up on the scroll view, it does not call the select hideHeaderBar
. Are there any fixes to this?
-(void)hideHeaderBar:(UISwipeGestureRecognizer*)swipeRecognizer{
POPSpringAnimation *fadeButton = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerOpacity];
fadeButton.toValue = @(0.0);
fadeButton.springBounciness = 0.f;
[settingsButton.layer pop_addAnimation:fadeButton forKey:@"fadeButton"];
[heartButton.layer pop_addAnimation:fadeButton forKey:@"fadeButton"];
[conversationsButton.layer pop_addAnimation:fadeButton forKey:@"fadeButton"];
POPSpringAnimation *hideHeader = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerPositionY];
hideHeader.toValue = @(-10);
hideHeader.springBounciness = 5.f;
[headerBar.layer pop_addAnimation:hideHeader forKey:@"hideHeaderAnim"];
POPSpringAnimation *hideBody = [POPSpringAnimation animationWithPropertyNamed:kPOPViewFrame];
hideBody.toValue = [NSValue valueWithCGRect:CGRectMake(0, -10, screenSize.size.width, screenSize.size.height)];
hideBody.springBounciness = 5.f;
[homeScrollView.layer pop_addAnimation:hideBody forKey:@"hideBodyAnim"];
}
One thing to note is that the UIScrollView
is in a child view controller (which is inside a UIScrollView
itself)
[self addChildViewController:settingsViewController];
[homeScrollView addSubview:settingsViewController.view];
[settingsViewController.view setFrame:CGRectMake(0, 0, screenSize.size.width, screenSize.size.height)];
[settingsViewController didMoveToParentViewController:self];