Commit c29ec0b3 authored by Carola Nitz's avatar Carola Nitz

VLCLibraryViewController: Fix crash when opening a folder

(cherry picked from commit c595185e)
parent b80121e7
......@@ -146,6 +146,7 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
if (!_collectionView) {
_folderLayout = [[VLCFolderCollectionViewFlowLayout alloc] init];
_reorderLayout = [[LXReorderableCollectionViewFlowLayout alloc] init];
_collectionView = [[UICollectionView alloc] initWithFrame:viewDimensions collectionViewLayout:_folderLayout];
_collectionView.alwaysBounceVertical = YES;
if (@available(iOS 11.0, *)) {
......@@ -316,7 +317,8 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
if (recognizer == _folderLayout.panGestureRecognizer || recognizer == _folderLayout.longPressGestureRecognizer || recognizer == _longPressGestureRecognizer)
[self.collectionView removeGestureRecognizer:recognizer];
}
_reorderLayout = [[LXReorderableCollectionViewFlowLayout alloc] init];
//reloadData before setting a new layout avoids a crash deep in UIKits UICollectionViewData layoutattributs
[self.collectionView reloadData];
[self.collectionView setCollectionViewLayout:_reorderLayout animated:NO];
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment