Skip to content

setParallaxHeaderView multiple times using UIScrollView doesn't work #29

@cerupcat

Description

@cerupcat

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions