Latest1.0.1
Homepagehttps://github.com/alibaba/LazyScrollView
LicenseMIT
Platformsios 7.0, requires ARC
Authors

[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:

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

Next, implement TMMuiLazyScrollViewDataSource:

@protocol TMMuiLazyScrollViewDataSource <NSObject>

@required

// Number of items in scrollView.
- (NSUInteger)numberOfItemInScrollView:(TMMuiLazyScrollView *)scrollView;

// Return the view model (TMMuiRectModel) by index.
- (TMMuiRectModel *)scrollView:(TMMuiLazyScrollView *)scrollView rectModelAtIndex:(NSUInteger)index;

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

@end

Next, set datasource of LazyScrollView:

scrollview.dataSource = self;

Finally, do reload:

[scrollview reloadData];

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

微信群

TMUtils

搜索 tangram_ 或者扫描以上二维码添加 Tangram 为好友,以便我们邀请你入群。

Latest podspec

{
    "name": "TMUtils",
    "version": "1.0.1",
    "summary": "Common safe methods & utils for NSArray & NSDictionary.",
    "homepage": "https://github.com/alibaba/LazyScrollView",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "HarrisonXi": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/alibaba/LazyScrollView.git",
        "tag": "1.0.1"
    },
    "source_files": "TMUtils/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This