alibaba/LazyScrollView

Name: LazyScrollView

Owner: Alibaba

Description: An iOS ScrollView to resolve the problem of reusability in views.

Created: 2017-03-02 02:30:22.0

Updated: 2018-05-24 06:12:33.0

Pushed: 2018-04-20 02:45:58.0

Homepage:

Size: 230

Language: Objective-C

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

CocoaPods CocoaPods CocoaPods

LazyScrollView

????

?? LazyScrollView??????????????? UI ???????????? Tangram-iOS?

LazyScrollView is an iOS ScrollView, to resolve the problem of reusability of views.

Comparing to UITableView, LazyScrollView can easily create different layout, instead of the single row flow layout.

Comparing to UICollectionView, LazyScrollView can create views without Grid layout, and provides a easier way to create different kinds of layous in a ScrollView.

We create a modular UI solution for building UI page dynamically based on LazyScrollView, you can see more info from this repo: Tangram-iOS

Installation

LazyScroll is available as LazyScroll in CocoaPods.

pod 'LazyScroll'

You can also download the source files from release page and add them into your project manually.

Usage

#import "TMMuiLazyScrollView.h"

Then, create LazyScrollView:

iLazyScrollView *scrollview = [[TMMuiLazyScrollView alloc]init];
llview.frame = self.view.bounds;

Next, implement TMMuiLazyScrollViewDataSource:

tocol TMMuiLazyScrollViewDataSource <NSObject>

uired

umber of items in scrollView.
SUInteger)numberOfItemInScrollView:(TMMuiLazyScrollView *)scrollView;

eturn the view model (TMMuiRectModel) by index.
MMuiRectModel *)scrollView:(TMMuiLazyScrollView *)scrollView rectModelAtIndex:(NSUInteger)index;

eturn view by the unique string that identify a model (muiID).
ou should render the item view here.
ou should ALWAYS try to reuse views by setting each view's reuseIdentifier.
IView *)scrollView:(TMMuiLazyScrollView *)scrollView itemByMuiID:(NSString *)muiID;


Next, set datasource of LazyScrollView:

llview.dataSource = self;

Finally, do reload:

ollview reloadData];

For more details, please clone the repo and open the demo project.

???

?? tangram_ ??????????? Tangram ??????????????


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.