mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 00:02:47 +00:00
Merge pull request #1261 from vector-im/scrollback_collections_to_the_left
HomeVC: Automatically scrollback to the left every time the screen is…
This commit is contained in:
commit
c2dc1cdc2e
1 changed files with 20 additions and 0 deletions
|
@ -72,6 +72,8 @@
|
|||
recentsDataSource.areSectionsShrinkable = NO;
|
||||
[recentsDataSource setDelegate:self andRecentsDataSourceMode:RecentsDataSourceModeHome];
|
||||
}
|
||||
|
||||
[self moveAllCollectionsToLeft];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
|
@ -84,6 +86,24 @@
|
|||
[super destroy];
|
||||
}
|
||||
|
||||
- (void)moveAllCollectionsToLeft
|
||||
{
|
||||
// Scroll all rooms collections to their beginning
|
||||
for (NSInteger section = 0; section < [self numberOfSectionsInTableView:self.recentsTableView]; section++)
|
||||
{
|
||||
UITableViewCell *firstSectionCell = [self.recentsTableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:section]];
|
||||
if (firstSectionCell && [firstSectionCell isKindOfClass:TableViewCellWithCollectionView.class])
|
||||
{
|
||||
TableViewCellWithCollectionView *tableViewCell = (TableViewCellWithCollectionView*)firstSectionCell;
|
||||
|
||||
if ([tableViewCell.collectionView numberOfItemsInSection:0] > 0)
|
||||
{
|
||||
[tableViewCell.collectionView scrollToItemAtIndexPath:[NSIndexPath indexPathForItem:0 inSection:0] atScrollPosition:UICollectionViewScrollPositionLeft animated:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Override RecentsViewController
|
||||
|
||||
- (void)displayList:(MXKRecentsDataSource *)listDataSource
|
||||
|
|
Loading…
Reference in a new issue