GithubHelp home page GithubHelp logo

medos1472 / vgparallaxheader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stoprocent/vgparallaxheader

0.0 1.0 0.0 13.39 MB

Only Parallax Header Class that should work with all kinds of Table Views and Scroll Views while using Auto Layout.

License: MIT License

Objective-C 97.02% Ruby 0.58% C 0.25% Shell 2.16%

vgparallaxheader's Introduction

VGParallaxHeader

Parallax Header Class (UIScrollView/UITableView Category) that should work with all kinds of Table Views and Scroll Views while using Auto Layout.

It is using tableHeaderView so no ugly hacks by adding subview to UITableView and changing contentInset. If you change contentInset section headers are displayed wrong. And YES ... it's very fast ;)

Best way to explore all configurations is to download Example Project and try it.

Demo GIF

https://raw.githubusercontent.com/stoprocent/VGParallaxHeader/master/demo.gif

Install

You can use CocoaPods:

pod 'VGParallaxHeader'

Version 0.0.6 Update

This version fix a little glitch i didnt notice in VGParallaxHeaderModeCenter mode when parallax header view height will jump 0.0f-0.5f. This was causing layoutSubviews being called on each scrollViewDidScroll.

Please note that VGParallaxHeaderModeCenter should be the fastest mode.

I think I'm almost ready to mark it as version 1.0 soon. If you have any requests or ideas let me know.

Version 0.0.5 Update

Please note that shadow is now depricated. If you are using setParallaxHeaderView:mode:height:shadowBehaviour: it will give you warning.

New version brings new property called Sticky View. You can replicate shadow with it. Have a look in examples and gif :) Have fun using new version and please report any problems in Github issues. Full Storyboard support is still pending and again I'm more than happy if someone will create pull request with this feature.

Using VGParallaxheader

Import UIScrollView+VGParallaxHeader.h, and use as follows:

- (void)viewDidLoad {
    [super viewDidLoad];

    HeaderView *headerView = [HeaderView alloc] init];
    
    // or self.tableView
    [self.scrollView setParallaxHeaderView:headerView
                                      mode:VGParallaxHeaderModeFill // For more modes have a look in UIScrollView+VGParallaxHeader.h 
                                    height:200];
                                    
    // Optional Sticky View :)
    UILabel *stickyLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    stickyLabel.backgroundColor = [UIColor colorWithRed:1 green:0.749 blue:0.976 alpha:1];
    stickyLabel.textAlignment = NSTextAlignmentCenter;
    stickyLabel.text = @"Say hello to Sticky View :)";
    
    self.tableView.parallaxHeader.stickyViewPosition = VGParallaxHeaderStickyViewPositionBottom; // VGParallaxHeaderStickyViewPositionTop
    [self.tableView.parallaxHeader setStickyView:stickyLabel
                                      withHeight:40];
}

#pragma mark - UIScrollView Delegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    // This must be called in order to work
    [scrollView shouldPositionParallaxHeader];
    
    // scrollView.parallaxHeader.progress - is progress of current scroll
    NSLog(@"Progress: %f", scrollView.parallaxHeader.progress);
    
    // This is how you can implement appearing or disappearing of sticky view
    [scrollView.parallaxHeader.stickyView setAlpha:scrollView.parallaxHeader.progress];
}

Bitdeli Badge

vgparallaxheader's People

Contributors

stoprocent avatar bitdeli-chef avatar dzamir avatar ignazioc avatar phillfarrugia avatar

Watchers

Izm Vankhai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.