Coder Social home page Coder Social logo

edgency / pwparallaxscrollview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wpsteak/pwparallaxscrollview

0.0 2.0 0.0 9.69 MB

PWParallaxScrollView is a library for creating sliding menus with parallax effect inspired by the WWF app

License: MIT License

pwparallaxscrollview's Introduction

PWParallaxScrollView

PWParallaxScrollView is a library for creating sliding menus with parallax effect inspired by the WWF app

##CocoaPods

pod "PWParallaxScrollView"

##Usage

#####import header

#import "PWParallaxScrollView.h"

#####follow PWParallaxScrollViewDataSource protocol

@interface ViewController <PWParallaxScrollViewDataSource>

#####implement PWParallaxScrollViewDataSource methods

- (NSInteger)numberOfItemsInScrollView:(PWParallaxScrollView *)scrollView;
- (UIView *)backgroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView;
- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView;

#####setting ForegroundScreenEdgeInsets

##About ForegroundScreenEdgeInsets ###custom your parallax offset

foregroundScreenEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 100);

#####sample code

    self.scrollView = [[PWParallaxScrollView alloc] initWithFrame:self.view.bounds];
    _scrollView.foregroundScreenEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 100);
    [self.view insertSubview:_scrollView atIndex:0];
    
- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView
{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 300, 70)];

	...
	    
    return label;
}

###Normal

foregroundScreenEdgeInsets = UIEdgeInsetsZero;

#####sample code

    self.scrollView = [[PWParallaxScrollView alloc] initWithFrame:self.view.bounds];
    _scrollView.foregroundScreenEdgeInsets = UIEdgeInsetsZero;
    [self.view insertSubview:_scrollView atIndex:0];
    
- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView
{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 300, 70)];

	...
	    
    return label;
}

##hit test

- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView
{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 300, 70)];
	...
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
	...
    [button addTarget:self action:@selector(test) forControlEvents:UIControlEventTouchUpInside];
    ...
    [label addSubview:button];
    
    return label;
}

##moveToIndex , prev , next

#####sample code

    [scrollView moveToIndex:3];
    [scrollView prevItem];
    [scrollView nextItem];

##background view only

#####just not implement the foregroundViewAtIndex:scrollView: method (or return nil)

- (UIView *)foregroundViewAtIndex:(NSInteger)index scrollView:(PWParallaxScrollView *)scrollView;


##Change Log 1.1.0

  • add interface builder support (initWithCoder, Outlets)

  • add PWParallaxDelegate and provides methods to check whether the current index is changed

###Thanks for contribution

  • @matibot

MIT License

PWParallaxScrollView is released under the MIT License (see the License file)

##Contact

Any suggestions or improvements?

feel free to contact me

[email protected]

pwparallaxscrollview's People

Contributors

wpsteak avatar matibot avatar

Watchers

James Cloos avatar edgency 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.