| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //
- // GKDBListView.m
- // GKPageScrollViewObjc
- //
- // Created by gaokun on 2020/12/17.
- // Copyright © 2020 gaokun. All rights reserved.
- //
- #import "GKDBListView.h"
- @interface GKDBListView()<UITableViewDataSource, UITableViewDelegate>
- @property (nonatomic, strong) UITableView *tableView;
- @end
- @implementation GKDBListView
- - (instancetype)init {
- if (self = [super init]) {
- [self addSubview:self.tableView];
- [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(self);
- }];
- }
- return self;
- }
- #pragma mark - UITableViewDataSource & UITableViewDelegate
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return 40;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
- cell.textLabel.text = [NSString stringWithFormat:@"第%zd行", indexPath.row + 1];
- return cell;
- }
- #pragma mark - GKPageSmoothListViewDelegate
- - (UIScrollView *)listScrollView {
- return self.tableView;
- }
- - (UIView *)listView {
- return self;
- }
- #pragma mark - 懒加载
- - (UITableView *)tableView {
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
- _tableView.dataSource = self;
- _tableView.delegate = self;
- [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
- }
- return _tableView;
- }
- @end
|