Coder Social home page Coder Social logo

wpsteak / pwparallaxscrollview Goto Github PK

View Code? Open in Web Editor NEW
487.0 15.0 50.0 9.63 MB

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

Home Page: http://wpsteak.github.io/PWParallaxScrollView

License: MIT License

Objective-C 61.24% Ruby 3.12% Swift 35.30% C 0.34%

pwparallaxscrollview's Introduction

PWParallaxScrollView (ObjC / Swift)

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

CocoaPods

for ObjC

pod 'PWParallaxScrollView', '~> 1.2.0'

for Swift,

pod 'PWParallaxScrollView/Swift', '~> 1.2.0'

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.2.0

  • add swift version

Thanks for contribution

  • @yume190

Change Log 1.1.5

add delegate to receive touchScrollViewTapped event

- (void)parallaxScrollView:(PWParallaxScrollView *)scrollView didRecieveTapAtIndex:(NSInteger)index;

Thanks for contribution

  • @Morgan-Kennedy

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

matibot avatar morgan-kennedy avatar wpsteak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pwparallaxscrollview's Issues

UITableView Doesn't Work in Foreground

in foreground, i added UIViews and in UIViews i added UITableView, when i run that code all things displays perfectly
3
4
ios simulator screen shot 27-jul-2015 1 12 40 pm

but when i touch on tableview, nothing happen on tableview...

Adding UIViews with UITableView as background objects

Hi,

It looks like PWParallaxScrollView does almost exactly what I need so I'm trying to include it in my project.

However, I've come across a problem: I need to add some objects extending UIView as background objects. These objects all contain a UITableView that is scrolled vertically. When I do that, I can't scroll the UITableView.

I examined your source code but couldn't find anything obvious which could be the cause of my problem.

Is it possible you could help me with this?

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.