GithubHelp home page GithubHelp logo

pscrollcontainer's Introduction

PScrollContainer

快速集成

pod 'PScrollContainer'

这是一个滑动容器库,支持自定义顶部分类样式需要实现PScrollViewConfig协议,类包含三个变量

@property (nonatomic, strong, nonnull) id<PScrollViewConfig> config;
@property (nonatomic, copy) void(^ _Nullable reloadData)(UITableView * _Nonnull tableView, NSInteger index);
@property (nonatomic, copy) UITableView *_Nonnull(^ _Nullable createTableView)(NSInteger index);

config是用来配置顶部分类的,reloadData是滑动过程中用来刷新数据的,createTableView是用来创建显示内容的tableView, 目前这个库的功能比较单一,后续会不断扩充

如何使用

需要通过addChildViewController的方式加入

PScrollViewController *scrollContainer = [[PScrollViewController alloc] init];
    scrollContainer.createTableView = ^UITableView * _Nonnull(NSInteger index) {
        self.dataArray = newData;
        UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
        tableView.backgroundColor = [UIColor clearColor];
        [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"];
        tableView.delegate = self;
        tableView.dataSource = self;
        tableView.tableFooterView = [UIView new];
        return tableView;
    };
    scrollContainer.reloadData = ^(UITableView * _Nonnull tableView, NSInteger index) {
        **加载新的数据,刷新列表**
        self.dataArray = newData;
        [tableView reloadData];
    };
    scrollContainer.config = [[ConfigObj alloc] init];
    [self addChildViewController:scrollContainer];
    [self.view addSubview:scrollContainer.view];

可能出现的问题

如果UI显示出现问题可以使用

self.automaticallyAdjustsScrollViewInsets = NO;

pscrollcontainer's People

Contributors

yangmiemie1116 avatar lovelitlefish avatar

Stargazers

kuroky avatar  avatar

Watchers

James Cloos avatar  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.