Coder Social home page Coder Social logo

orucanil / endlesstableview Goto Github PK

View Code? Open in Web Editor NEW
21.0 5.0 8.0 19 KB

Endless - Infinite & Double Table Together Parallax Animation & Auto Scrolling (UITableView)

Home Page: https://www.linkedin.com/in/annul

License: MIT License

Objective-C 100.00%
uitableview infinite auto-scroll parallax-animation ios objective-c

endlesstableview's Introduction

EndlessTableView

Endless - Infinite & Double Table Together Parallax Animation & Auto Scrolling

Display Visual Examples


Visual1

Installation

To use the EndlessTableView class in an app, just drag the EndlessTableView class files (demo files and assets are not needed) into your project.

Properties

The EndlessTableView has the following properties (note: for iOS, UITableView when using properties):

@property (nonatomic) BOOL enableEndlessScrolling 

The default value is YES.

@property (nonatomic) BOOL enableAutoScrolling;

The default value is NO.

@property (nonatomic) CGFloat autoScrollValue;

This property can be used to set the table scrolling at a constant speed. A value of 1.0 would scroll the carousel forwards at a rate of one item per second. The autoscroll value can be positive or negative and defaults to 0.0 (stationary). Autoscrolling will stop if the user interacts with the table, and will resume when they stop. The default value is 0.0f.

@property (nonatomic) CGFloat differenceRateValue;

If attachedTableView and contentSize of this event of an equal, differenceRateValue processing are taken. The default value is 1.0f.

@property (nonatomic,weak) EndlessTableView *attachedTableView;

The default value is nil.

How to use ?

Visual4

#import "EndlessTableView.h"

@interface ViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (weak, nonatomic) IBOutlet EndlessTableView *tableViewProduct;
@property (weak, nonatomic) IBOutlet EndlessTableView *tableViewCampaign;

...

- (void)loadView
{
[super loadView];

self.tableViewProduct.attachedTableView = self.tableViewCampaign;
self.tableViewProduct.enableAutoScrolling = YES;
self.tableViewProduct.differenceRateValue = 1.3f;

[_tableViewProduct reloadData];

[_tableViewCampaign reloadData];

}

...

#pragma mark - TableView Datasource & Delegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

NSInteger numberOfRows = 0;

if (tableView == _tableViewCampaign)
numberOfRows = 10;
else if (tableView == _tableViewProduct)
numberOfRows = 8;

return numberOfRows;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

UITableViewCell *cell =  [tableView dequeueReusableCellWithIdentifier:@"EndlessTableViewCell"];

if (tableView == _tableViewCampaign)
{

}
else if (tableView == _tableViewProduct)
{

}
return cell;

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}

OR

#import "EndlessTableView.h"

@interface ViewController ()<UITableViewDataSource,UITableViewDelegate>

...

- (void)loadView
{
[super loadView];

EndlessTableView *tableViewCampaign = [[EndlessTableView alloc]initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width / 2, 0.0f, [UIScreen mainScreen].bounds.size.width / 2, [UIScreen mainScreen].bounds.size.height)];
tableViewCampaign.tag = 0;
tableViewCampaign.dataSource = self;
tableViewCampaign.delegate = self;

EndlessTableView *tableViewProduct = [[EndlessTableView alloc]initWithFrame:CGRectMake(0.0f, 0.0f, [UIScreen mainScreen].bounds.size.width / 2, [UIScreen mainScreen].bounds.size.height)];
tableViewProduct.tag = 1;
tableViewProduct.dataSource = self;
tableViewProduct.delegate = self;

tableViewProduct.attachedTableView = tableViewCampaign;
tableViewProduct.enableAutoScrolling = YES;
tableViewProduct.differenceRateValue = 1.3f;

}

...

#pragma mark - TableView Datasource & Delegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

NSInteger numberOfRows = 0;

if (tableView.tag == 0) // Campaign TableView
numberOfRows = 10;
else if (tableView.tag == 1) // Product TableView
numberOfRows = 8;

return numberOfRows;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

UITableViewCell *cell =  [tableView dequeueReusableCellWithIdentifier:@"EndlessTableViewCell"];

if (tableView.tag == 0) // Campaign TableView
{

}
else if (tableView.tag == 1) // Product TableView
{

}
return cell;

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

}

Build and run the project files. Enjoy more examples!

endlesstableview's People

Contributors

orucanil avatar

Stargazers

 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

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.