A powerful UITableView with inbuilt PullToRefresh and Load More (Infinite Scrolling) functionality. RSMasterTableView is built upon [SVPullToRefresh] (https://github.com/samvermette/SVPullToRefresh) for PullToRefresh and Infinite Scrolling.
RSMasterTableView can be used a normal tableView as well as with PullToRefresh and Infinite Scrolling. No need to write complex code to manage data and paging structure.
- Enable PullToRefresh and Infinite Scrolling using single method.
- Manage Paging in TableView internally by calling simple methods.
[self.tableView enablePullToRefreshWithActionHandler:^{
/* Make your API call here */
[self fetchDataFromServer];
}];
[self.tableView enableInfiniteScrollingWithActionHandler:^{
/* Make your API call here */
[self fetchDataFromServer];
}];
#pragma mark- TableView Setup
-(void)configureTableView {
/* setup tableView */
[self.tableView setupTableViewCellConfiguration:^(id cell, id object, NSIndexPath *indexPath) {
/* set data to TableView cell */
} forCellIdentifier:@"cell"];
/* enable Infinite Scrolling */
[self.tableView enableInfiniteScrollingWithActionHandler:^{
/* Make your API call here */
[self fetchDataFromServer];
}];
/* modify statIndex, records per page etc */
self.tableView.startIndex = 1;
self.tableView.recordsPerPage = 20;
self.tableView.noDataFoundMessage = @"No Records found";
}
-(void)fetchDataFromServer {
/* send request here */
id response; /* get response here */
[self didGetResponseFromServer:response];
}
#pragma mark- Success
-(void)didGetResponseFromServer:(id)response {
/* inform tableview about data array and total pages */
NSMutableArray *array = response;
NSUInteger totalDatacount = 100; /* get total count from server */
[self.tableView didCompleteFetchData:array withTotalCount:totalDatacount];
}
#pragma mark- Failure
-(void)didFailToGetData {
/* inform tableview in failure */
[self.tableView didFailToFetchdata];
}
RSMasterTableView is released under the MIT license. See LICENSE for details.