PScrollContainer 0.3.6

PScrollContainer 0.3.6

测试已测试
Lang语言 Obj-CObjective C
许可 未知
Released上次发布2019年4月

sheep. 维护。



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;