Latest 1.0.3
Homepage https://github.com/RTILab/RTDataSourceAdapter
License MIT
Platforms ios 8.0
Authors

RTDataSourceAdapter

RTDataSourceAdapter is a library that simplifies work with the UITableView controls.

"

Usage

In your Controller
#import <RTDataSourceAdapter.h>

@interface ViewController : UIViewController
....
@property (weak, nonatomic) IBOutlet UITableView *myTable;
@property (strong, nonatomic) RTDataSourceAdapter *adapter;
....
@end
Creating RTDataSourceAdapter
self.adapter = [[RTDataSourceAdapter alloc] init];
self.myTable.tintColor = [UIColor redColor]; // <- color for load indicator
self.adapter.pullToRefreshWidth = 320; // <- optional, width for RefreshControl container
self.adapter.deselectable = YES; // <- can deselect row. Default:NO

[self.adapter registerTableView:self.myTable 
cellIdentifiers:cellIdentifiers // <- Array of cells identifiers (NSString)
//also you can use  "cellIdentifier:(NSString *)" for one cell identifier
addPullToRefresh:YES  // <- I think clearly - add refresh control :)
pageLoadingEnabled:YES]; //<- It adds the ability to loading parts :)
Filling RTDataSourceAdapter
[self.adapter.content clear]; // remove all object

[self.adapter.content addItem:cellIdentifier value:YOURmodel]; 
//or
[self.adapter.content addItem:[[RTAdapterItem alloc] initWithID:cellIdentifier value:YOURmodel]];

[self.adapter reloadData]; //update state
Events processing:
//cell selected
[self.adapter setSelectHandler:^(RTAdapterItem *selectedObject, NSIndexPath *indexPath) {
//your code
}];
//pull to refresh action
[self.adapter setPullToRefreshHandler:^{
//your code
}];
//load new page action
[self.adapter setLoadMoreHandler:^{
//your code
}];
Creating a cell

Cells must be inherited from RTBaseAdapterTableViewCell

#import <RTBaseAdapterTableViewCell.h>
@interface ExampleCell : RTBaseAdapterTableViewCell
....
@end

and override two methods

@implementation MYTableViewCell
- (void)cellContent:(YOURModel *)content
{
//your code
}

+ (CGFloat)heightFromCellContent:(YOURModel *)content
{
// calculate height
return cellHeight;
}
@end

Install

RTDataSourceAdapter is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod install 'RTDataSourceAdapter'

In case you don’t want to use CocoaPods – just copy the folder RTDataSourceAdapter to your Xcode project.

Maintainers

License

RTDataSourceAdapter is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "RTLoading",
    "version": "1.0.3",
    "summary": "Loading indicator.",
    "description": "RTLoading is a extension which allow easy add loading indicator into any view.",
    "homepage": "https://github.com/RTILab/RTDataSourceAdapter",
    "license": "MIT",
    "authors": {
        "Ivan  Morozov": "[email protected]"
    },
    "social_media_url": "https://ru-ru.facebook.com/people/Ivan-Morozov/100006824496626",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/RTILab/RTLoading.git",
        "branch": "master",
        "tag": "1.0.3"
    },
    "source_files": "src/RTLoading/*.{h,m}",
    "resources": [
        "src/RTLoading/*.png"
    ]
}

Pin It on Pinterest

Share This