Giter Site home page Giter Site logo

mxiris-library-forks / lazyscrollview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alibaba/lazyscrollview

0.0 0.0 0.0 169 KB

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

License: MIT License

Ruby 2.39% Python 1.97% Objective-C 95.64%

lazyscrollview's Introduction

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.

lazyscrollview's People

Contributors

harrisonxi avatar fydx avatar wanhmr avatar zhongwuzw avatar mx-iris avatar mikeafc avatar longerian 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.