MXKDataSource refactoring

Table view cell are now defined at view controller level.
This commit is contained in:
giomfo
2015-12-07 11:50:13 +01:00
parent 5d484d9a63
commit ef69af9adb
5 changed files with 52 additions and 22 deletions
+3 -7
View File
@@ -16,8 +16,6 @@
#import "RecentsDataSource.h"
#import "RecentTableViewCell.h"
#import "EventFormatter.h"
#import "VectorDesignValues.h"
@@ -44,9 +42,6 @@
self = [super init];
if (self)
{
// Reset default view classes
[self registerCellViewClass:RecentTableViewCell.class forCellIdentifier:kMXKRecentCellIdentifier];
// Replace event formatter
self.eventFormatter = [[EventFormatter alloc] initWithMatrixSession:self.mxSession];
@@ -210,11 +205,12 @@
- (CGFloat)cellHeightAtIndexPath:(NSIndexPath *)indexPath
{
// Override this method here to use our own cellDataAtIndexPath
id<MXKRecentCellDataStoring> cellData = [self cellDataAtIndexPath:indexPath];
if (cellData)
if (cellData && self.delegate)
{
Class<MXKCellRendering> class = [self cellViewClassForCellIdentifier:kMXKRecentCellIdentifier];
Class<MXKCellRendering> class = [self.delegate cellViewClassForCellData:cellData];
return [class heightForCellData:cellData withMaximumWidth:0];
}