Skip to content

Commit

Permalink
Allow setting the nibName on data renderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasperblues committed Jun 15, 2012
1 parent 5e3682e commit c7dab1e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Expand Up @@ -20,6 +20,7 @@

NSMutableArray* _filteredListContent;
NSUInteger _cellHeight;
NSString* _nibNameForTableCell;

}

Expand All @@ -43,6 +44,8 @@
*/
@property(nonatomic, strong, readonly) UISearchDisplayController* searchController;

@property(nonatomic, strong) NSString* nibNameForTableCell;

/**
* Injection point for loading custom table cells from a nib.
*/
Expand Down Expand Up @@ -74,10 +77,6 @@
*/
- (void) filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope;

/**
* Abstract method that returns the name of the nib to use.
*/
- (NSString*) nibNameForTableCell;

- (UITableViewCell*) loadTableCellFromNib;

Expand Down
Expand Up @@ -11,7 +11,6 @@

#import "expanz_ui_AbstractDataRenderer.h"
#import "expanz_model_AbstractData.h"
#import "expanz_ui_NavigationManager.h"


@implementation expanz_ui_AbstractDataRenderer
Expand All @@ -21,6 +20,7 @@ @implementation expanz_ui_AbstractDataRenderer
@synthesize activityName = _activityName;
@synthesize searchController = _searchController;
@synthesize tableCell = _tableCell;
@synthesize nibNameForTableCell = _nibNameForTableCell;


/* ================================================== Initializers ================================================== */
Expand Down
Expand Up @@ -31,6 +31,7 @@ - (Row*) tableView:(UITableView*)tableView rowForIndexPath:(NSIndexPath*)indexPa
- (void) thumbnailTableViewCell:(ThumbnailTableCell*)cell setThumbnailImageFor:(Row*)row;

@end

/* ================================================================================================================== */

@implementation expanz_ui_GridDataRenderer
Expand Down Expand Up @@ -147,7 +148,10 @@ - (void) filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
}

- (NSString*) nibNameForTableCell {
return @"DefaultTableCellForGridData";
if ([_nibNameForTableCell length] == 0) {
_nibNameForTableCell = @"DefaultTableCellForGridData";
}
return _nibNameForTableCell;
}


Expand Down
Expand Up @@ -111,7 +111,10 @@ - (void) filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
}

- (NSString*) nibNameForTableCell {
return @"DefaultTableCellForTreeData";
if ([_nibNameForTableCell length] == 0) {
_nibNameForTableCell = @"DefaultTableCellForTreeData";
}
return _nibNameForTableCell;
}

/* ================================================== Private Methods =============================================== */
Expand Down

0 comments on commit c7dab1e

Please sign in to comment.