Latest 1.1.0
Homepage https://github.com/YK-Unit/YKPageControllerScrollView
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation
Authors

YKPageControllerScrollView是一个UIViewController容器类滚动视图,支持UIViewControlle重用机制。


Insatll

CocoPods

pod 'YKPageControllerScrollView'

Usage

// viewController.m

- (void)viewDidLoad {
    [super viewDidLoad];

    self.pageControllerScrollView = [[YKPageControllerScrollView alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 320) containerViewController:self];
    self.pageControllerScrollView.delegate = self;
    [self.pageControllerScrollView registerClassForController:[ColorViewController class]];
    [self.view addSubview:self.pageControllerScrollView];

    [self.pageControllerScrollView reloadData];
}   

#pragma mark - YKPageControllerScrollViewDelegate
- (NSInteger)numberOfControllersInPageControllerScrollView:(YKPageControllerScrollView *)scrollView
{
    return 10;
}

- (nonnull UIViewController<YKPageControllerScrollViewLifeCycleProtocol> *)pageControllerScrollView:(nonnull YKPageControllerScrollView *)pageControllerScrollView controllerForItemAtIndex:(NSInteger)index
{
    UIViewController<YKPageControllerScrollViewLifeCycleProtocol> *vc = [pageControllerScrollView dequeueReusableViewControllerWithReuseClass:[ColorViewController class] forIndex:index];

    if (vc == nil) {
        vc = [[ColorViewController alloc] init];
    }

    return vc;
}

设计思路

关于 YKPageControllerScrollView 的设计思路,可以看我写的blog《YKPageControllerScrollView设计总结》

Latest podspec

{
    "name": "YKPageControllerScrollView",
    "version": "1.1.0",
    "summary": "A multi-controllers of scrollView.",
    "description": "A multi-controllers of scrollView, and provides a reusability mechanism like tableview.",
    "homepage": "https://github.com/YK-Unit/YKPageControllerScrollView",
    "license": "MIT",
    "authors": {
        "York": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/YK-Unit/YKPageControllerScrollView.git",
        "tag": "1.1.0"
    },
    "source_files": "YKPageControllerScrollView/*",
    "frameworks": "Foundation",
    "requires_arc": true
}

Pin It on Pinterest

Share This