From 0a84b827afc2f487ae4d34e67c80d62a357cbb14 Mon Sep 17 00:00:00 2001 From: Giom Foret Date: Thu, 28 Dec 2017 11:51:09 +0100 Subject: [PATCH] Groups: self-management of membership of groups - MXKGroupListViewController: Support dynamic fonts by enabling self-sizing table view cell. vector-im/riot-meta#114 --- MatrixKit/Controllers/MXKGroupListViewController.m | 4 ---- .../Controllers/MXKGroupListViewController.xib | 6 +++--- MatrixKit/Models/Group/MXKSessionGroupsDataSource.h | 8 -------- MatrixKit/Models/Group/MXKSessionGroupsDataSource.m | 13 ------------- MatrixKit/Views/MXKCellRendering.h | 5 +++++ 5 files changed, 8 insertions(+), 28 deletions(-) diff --git a/MatrixKit/Controllers/MXKGroupListViewController.m b/MatrixKit/Controllers/MXKGroupListViewController.m index 33965e0a3..587685f34 100644 --- a/MatrixKit/Controllers/MXKGroupListViewController.m +++ b/MatrixKit/Controllers/MXKGroupListViewController.m @@ -364,10 +364,6 @@ - (void)dataSource:(MXKDataSource *)dataSource didRemoveMatrixSession:(MXSession } #pragma mark - UITableView delegate -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath -{ - return [dataSource cellHeightAtIndexPath:indexPath]; -} - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { diff --git a/MatrixKit/Controllers/MXKGroupListViewController.xib b/MatrixKit/Controllers/MXKGroupListViewController.xib index ce392cc10..62a0442a3 100644 --- a/MatrixKit/Controllers/MXKGroupListViewController.xib +++ b/MatrixKit/Controllers/MXKGroupListViewController.xib @@ -1,10 +1,10 @@ - + - + @@ -33,7 +33,7 @@ - + diff --git a/MatrixKit/Models/Group/MXKSessionGroupsDataSource.h b/MatrixKit/Models/Group/MXKSessionGroupsDataSource.h index 26d159232..7ee1ac3c0 100644 --- a/MatrixKit/Models/Group/MXKSessionGroupsDataSource.h +++ b/MatrixKit/Models/Group/MXKSessionGroupsDataSource.h @@ -84,14 +84,6 @@ extern NSString *const kMXKGroupCellIdentifier; */ - (NSIndexPath*)cellIndexPathWithGroupId:(NSString*)groupId; -/** - Get height of the cell at the given index. - - @param indexPath the index of the cell in the table - @return the cell height - */ -- (CGFloat)cellHeightAtIndexPath:(NSIndexPath*)indexPath; - /** Leave the group displayed at the provided path. diff --git a/MatrixKit/Models/Group/MXKSessionGroupsDataSource.m b/MatrixKit/Models/Group/MXKSessionGroupsDataSource.m index 5aef3251d..c4936b5d8 100644 --- a/MatrixKit/Models/Group/MXKSessionGroupsDataSource.m +++ b/MatrixKit/Models/Group/MXKSessionGroupsDataSource.m @@ -211,19 +211,6 @@ - (NSIndexPath*)cellIndexPathWithGroupId:(NSString*)groupId return nil; } -- (CGFloat)cellHeightAtIndexPath:(NSIndexPath*)indexPath -{ - if (self.delegate) - { - id cellData = [self cellDataAtIndex:indexPath]; - - Class class = [self.delegate cellViewClassForCellData:cellData]; - return [class heightForCellData:cellData withMaximumWidth:0]; - } - - return 0; -} - #pragma mark - Groups processing - (void)loadData diff --git a/MatrixKit/Views/MXKCellRendering.h b/MatrixKit/Views/MXKCellRendering.h index f45b80125..60d712910 100644 --- a/MatrixKit/Views/MXKCellRendering.h +++ b/MatrixKit/Views/MXKCellRendering.h @@ -49,6 +49,11 @@ /** Compute the height of the cell to display the passed data. + @TODO: To support correctly the dynamic fonts, we have to remove this method and + its use by enabling self sizing cells at the table view level. + When we create a self-sizing table view cell, we need to set the property `estimatedRowHeight` of the table view + and use constraints to define the cell’s size. + @param cellData the data object to render. @param maxWidth the maximum available width. @return the cell height