Commit 6989e3c9 authored by Gleb Pinigin's avatar Gleb Pinigin

Playlist: correcly calculate insets for both interface orientations

parent 7ab453c4
......@@ -109,12 +109,9 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
_tableView.opaque = YES;
_tableView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
}
self.view = _tableView;
[_tableView reloadData];
if (setInset) {
CGFloat originY = self.navigationController.navigationBar.frame.size.height + [UIApplication sharedApplication].statusBarFrame.size.height;
_tableView.contentInset = UIEdgeInsetsMake(originY, 0, 0, 0);
}
} else {
if (!_collectionView) {
_folderLayout = [[VLCFolderCollectionViewFlowLayout alloc] init];
......@@ -135,11 +132,20 @@ static NSString *kDisplayedFirstSteps = @"Did we display the first steps tutoria
}
self.view = _collectionView;
[_collectionView reloadData];
if (setInset) {
CGFloat originY = self.navigationController.navigationBar.frame.size.height + [UIApplication sharedApplication].statusBarFrame.size.height;
}
if (setInset) {
CGSize statusBarSize = [UIApplication sharedApplication].statusBarFrame.size;
// Status bar frame doesn't change correctly on rotation
CGFloat statusBarHeight = MIN(statusBarSize.height, statusBarSize.width);
CGFloat originY = self.navigationController.navigationBar.frame.size.height + statusBarHeight;
if (_usingTableViewToShowData)
_tableView.contentInset = UIEdgeInsetsMake(originY, 0, 0, 0);
else
_collectionView.contentInset = UIEdgeInsetsMake(originY, 0, 0, 0);
}
}
self.view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
}
......
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