diff --git a/Riot/ViewController/HomeViewController.m b/Riot/ViewController/HomeViewController.m index a9acfb47d..1d54d955d 100644 --- a/Riot/ViewController/HomeViewController.m +++ b/Riot/ViewController/HomeViewController.m @@ -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