VGParallaxHeader
VGParallaxHeader copied to clipboard
setParallaxHeaderView multiple times using UIScrollView doesn't work
I'm trying to update the view and height of a parallaxHeader. I'm calling setParallaxHeaderView every time to update it (since I don't see another method). However, when you try and call setParallaxHeaderView on a scrollView more than once, the offsets aren't taken into account and the header keeps moving down the page. I'm not exactly sure how to fix this or update/change the view and height.
You can test this by putting this in viewDidLoad of UIScrollView example:
HeaderView *headerView = [HeaderView instantiateFromNib];
[self.scrollView setParallaxHeaderView:headerView
mode:VGParallaxHeaderModeCenter
height:200];
// Delay execution of my block for 10 seconds.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
HeaderView *headerView = [HeaderView instantiateFromNib];
[self.scrollView setParallaxHeaderView:headerView
mode:VGParallaxHeaderModeCenter
height:200];
});
// Delay execution of my block for 10 seconds.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
HeaderView *headerView = [HeaderView instantiateFromNib];
[self.scrollView setParallaxHeaderView:headerView
mode:VGParallaxHeaderModeCenter
height:200];
});
// Delay execution of my block for 10 seconds.
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
HeaderView *headerView = [HeaderView instantiateFromNib];
[self.scrollView setParallaxHeaderView:headerView
mode:VGParallaxHeaderModeCenter
height:200];
});
Thanks @maxep. I'm using your MXSegmentedPager and it looks like you're using your repo version for this so that'll fix my issue. :)
Actually, @maxep it looks like MXSegmentedPager isn't using your fork and therefore it has the same issue. Any chance of updating to use your fork instead? I'll make a ticket.