This repo will no longer be updated. The new versions has been moved to HybridPageKit as a submodule. Integrate ' HybridPageKit/ScrollReuseHandler ' subspecs with Cocoapods.
Extended Reading | 中文 | 扩展阅读
ReusableNestingScrollview
is a component to solve the problem of SubView global reuse and recovery in rolling views. Unlike traditional similar solutions, RNS
does not need to inherit a special ScrollView, does not need to inherit a special Model ,only by extending the Delegate, so that the rolling views such as WKWebView, UIWebView, and so on are more widely supported, more general and independent.
Together with WKWebViewExtension, sub repo of HybridPageKit, which is a general sulotion of news App content page.
iOS 8.0 or later
-
CocoaPods
platform :ios, '8.0' pod 'ReusableNestingScrollview'
-
Cloning the repository
#import "RNSHandler.h"
- Easy integration, just need 10+ lines code.
- Do not need inherit special ScrollView and special Model. Support WKWebView & UIWebView.
- Data-driven, Protocol Oriented Programming.
- Add workrange. Better view`s state management, flexible handling of business logic.
- Scroll reuse & Global reuse, and Thread safe.
#Usage
- Extend View`s Model By RNSModelProtocol
@interface TestModel : NSObject <RNSModelProtocol>
RNSProtocolImp(_uniqueId, _componentFrame, [componentView class],[componentController class], _customContext);
- Config ScrollView delegate
_handler = [[RNSHandler alloc]initWithScrollView:scrollView
externalScrollViewDelegate:self
scrollWorkRange:200.f
componentViewStateChangeBlock:^(RNSComponentViewState state,
NSObject<RNSModelProtocol> *componentItem, __kindof UIView *componentView) {
// handle component state change
// will Prepare & will Display & end Display & end prepare
}];
- reload Data with Model
[_handler reloadComponentViewsWithProcessBlock:^(NSMutableDictionary<NSString *,NSObject<RNSModelProtocol> *> *componentItemDic) {
// update model`s origin
}];
All source code is licensed under the MIT License.