forked from RestKit/RestKit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added category introducing convenience methods for initializing table…
… controller from the object manager
- Loading branch information
1 parent
c779462
commit 07a18a7
Showing
4 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// RKObjectManager+RKTableController.h | ||
// RestKit | ||
// | ||
// Created by Blake Watters on 2/23/12. | ||
// Copyright (c) 2012 RestKit. All rights reserved. | ||
// | ||
|
||
#import "RKObjectManager.h" | ||
|
||
#ifdef TARGET_OS_IPHONE | ||
|
||
@class RKTableController, RKFetchedResultsTableController; | ||
|
||
/** | ||
Provides extensions to RKObjectManager for instantiating RKTableController instances | ||
*/ | ||
@interface RKObjectManager (RKTableController) | ||
|
||
/** | ||
Creates and returns a table controller object capable of loading remote object representations | ||
into a UITableView using the RestKit object mapping engine for a given table view controller. | ||
@param tableViewController A UITableViewController to instantiate a table controller for | ||
@return An RKTableController instance ready to drive the table view for the provided tableViewController. | ||
*/ | ||
- (RKTableController *)tableControllerForTableViewController:(UITableViewController *)tableViewController; | ||
|
||
/** | ||
Creates and returns a table controller object capable of loading remote object representations | ||
into a UITableView using the RestKit object mapping engine for a given table view and view controller. | ||
@param tableView The UITableView object that table controller with acts as the delegate and data source for. | ||
@param viewController The UIViewController that owns the specified tableView. | ||
@return An RKTableController instance ready to drive the table view for the provided tableViewController. | ||
*/ | ||
- (RKTableController *)tableControllerWithTableView:(UITableView *)tableView forViewController:(UIViewController *)viewController; | ||
|
||
/** | ||
Creates and returns a fetched results table controller object capable of loading remote object representations | ||
stored in Core Data into a UITableView using the RestKit object mapping engine for a given table view controller. | ||
@param tableViewController A UITableViewController to instantiate a table controller for | ||
@return An RKFetchedResultsTableController instance ready to drive the table view for the provided tableViewController. | ||
*/ | ||
- (RKFetchedResultsTableController *)fetchedResultsTableControllerForTableViewController:(UITableViewController *)tableViewController; | ||
|
||
/** | ||
Creates and returns a table controller object capable of loading remote object representations | ||
stored in Core Data into a UITableView using the RestKit object mapping engine for a given table view and view controller. | ||
@param tableView The UITableView object that table controller with acts as the delegate and data source for. | ||
@param viewController The UIViewController that owns the specified tableView. | ||
@return An RKFetchedResultsTableController instance ready to drive the table view for the provided tableViewController. | ||
*/ | ||
- (RKFetchedResultsTableController *)fetchedResultsTableControllerWithTableView:(UITableView *)tableView forViewController:(UIViewController *)viewController; | ||
|
||
@end | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// | ||
// RKObjectManager+RKTableController.m | ||
// RestKit | ||
// | ||
// Created by Blake Watters on 2/23/12. | ||
// Copyright (c) 2012 RestKit. All rights reserved. | ||
// | ||
|
||
#import "RKObjectManager+RKTableController.h" | ||
|
||
#ifdef TARGET_OS_IPHONE | ||
|
||
#import "RKTableController.h" | ||
#import "RKFetchedResultsTableController.h" | ||
|
||
@implementation RKObjectManager (RKTableController) | ||
|
||
- (RKTableController *)tableControllerForTableViewController:(UITableViewController *)tableViewController { | ||
RKTableController *tableController = [RKTableController tableControllerForTableViewController:tableViewController]; | ||
tableController.objectManager = self; | ||
return tableController; | ||
} | ||
|
||
- (RKTableController *)tableControllerWithTableView:(UITableView *)tableView forViewController:(UIViewController *)viewController { | ||
RKTableController *tableController = [RKTableController tableControllerWithTableView:tableView forViewController:viewController]; | ||
tableController.objectManager = self; | ||
return tableController; | ||
} | ||
|
||
- (RKFetchedResultsTableController *)fetchedResultsTableControllerForTableViewController:(UITableViewController *)tableViewController { | ||
RKFetchedResultsTableController *tableController = [RKFetchedResultsTableController tableControllerForTableViewController:tableViewController]; | ||
tableController.objectManager = self; | ||
return tableController; | ||
} | ||
|
||
- (RKFetchedResultsTableController *)fetchedResultsTableControllerWithTableView:(UITableView *)tableView forViewController:(UIViewController *)viewController { | ||
RKFetchedResultsTableController *tableController = [RKFetchedResultsTableController tableControllerWithTableView:tableView forViewController:viewController]; | ||
return tableController; | ||
} | ||
|
||
@end | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters