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
Size: 230
Language: Objective-C
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
?? 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
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.
#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 ??????????????