Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nghialv/tvdatasource
datasource class for uitableview
https://github.com/nghialv/tvdatasource
Last synced: 29 days ago
JSON representation
datasource class for uitableview
- Host: GitHub
- URL: https://github.com/nghialv/tvdatasource
- Owner: nghialv
- License: mit
- Created: 2013-08-02T02:49:01.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-05T04:36:48.000Z (over 11 years ago)
- Last Synced: 2024-10-04T13:39:32.409Z (about 2 months ago)
- Language: Objective-C
- Size: 76.2 KB
- Stars: 17
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TVArrayDataSource
This class will help you implement TableView faster.### Instalation
TADataSource can be installed via CocoaPods.
```
pod 'TVArrayDataSource'
```
or simply download and import TVArrayDataSource.h, TVArrayDataSource.m in your project manually.### Usage
#### configure datasource by using block
```
// create block
TVCellConfigureBlock configureCell = ^(TVCellByXib *cell, NSString *name) {
[cell.title setText:name];
};self.dataSource = [[TVArrayDataSource alloc] initWithItems:items
cellIdentifier:@"MYCELL"
cellConfigureBlock:configureCell];
[self.dataSource setXibFileName:@"TVSimpleCell"];
tableView.dataSource = self.dataSource;
```
#### or by selector
```
// create datasource and set selector
self.dataSource = [[TVArrayDataSource alloc] initWithItems:items
cellIdentifier:@"MYCELL"
target:self
cellConfigureSel:@selector(configureCell:andItem:)];
[self.dataSource setCellClassName:@"TVCellByCode"];
```
```
-(void)configureCell:(UITableViewCell *)cell andItem:(NSString *)item
{
[cell.textLabel setText:item];
}
```