Latest 1.0.1
Homepage https://github.com/xiaozhuxiong121/PGBaseDataSource
License MIT
Platforms ios 7.0, requires ARC
Frameworks UIKit
Authors

将dataSource分离出去,减小TableViewController的体积。

CocoaPods安装

pod 'PGBaseDataSource

一般普通的写法

#pragma mark UITableViewDataSource

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    PGTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellReuseIdentifier];
    return cell;
}

PGBaseDataSource的写法

//设置dataSource
self.tableView.dataSource = [PGBaseDataSource instance];
[[PGBaseDataSource instance] numberOfSectionsInTableView:^NSUInteger(UITableView *tableView) {
    return 1;
} numberOfRowsInSection:^NSUInteger(UITableView *tableView, NSInteger section) {
    return 10;
} cellForRowAtIndexPath:^UITableViewCell *(UITableView *tableView, NSIndexPath *indexPath) {
    PGTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellReuseIdentifier];
    return cell;
}];

Github Address

https://github.com/xiaozhuxiong121/PGBaseDataSource

Latest podspec

{
    "name": "PGBaseDataSource",
    "version": "1.0.1",
    "summary": "u5c06dataSourceu5206u79bbu51fau53bbuff0cu51cfu5c0fTableViewControlleru7684u4f53u79efu3002",
    "homepage": "https://github.com/xiaozhuxiong121/PGBaseDataSource",
    "license": "MIT",
    "authors": {
        "piggybear": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/xiaozhuxiong121/PGBaseDataSource.git",
        "tag": "1.0.1"
    },
    "source_files": [
        "PGBaseDataSource",
        "PGBaseDataSource/**/*.{h,m}"
    ],
    "frameworks": "UIKit",
    "requires_arc": true
}

Pin It on Pinterest

Share This