Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
2f079e32
Commit
2f079e32
authored
Sep 20, 2015
by
Carola
Browse files
correctly resize collectionview cells on different devices
parent
1a518bb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Sources/VLCLibraryViewController.m
View file @
2f079e32
...
...
@@ -781,10 +781,17 @@ static NSString *kUsingTableViewToShowData = @"UsingTableViewToShowData";
-
(
CGSize
)
collectionView
:(
UICollectionView
*
)
collectionView
layout
:(
UICollectionViewLayout
*
)
collectionViewLayout
sizeForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
(
UIInterfaceOrientationIsLandscape
([
UIApplication
sharedApplication
].
statusBarOrientation
))
return
CGSizeMake
(
341
.,
190
.);
else
return
CGSizeMake
(
384
.,
216
.);
const
CGFloat
maxCellWidth
=
300
.
0
;
const
CGFloat
aspectRatio
=
9
/
16
;
CGRect
windowFrame
=
[
UIApplication
sharedApplication
].
keyWindow
.
frame
;
CGFloat
windowWidth
=
windowFrame
.
size
.
width
;
int
numberOfCellsPerRow
=
ceil
(
windowWidth
/
maxCellWidth
);
CGFloat
cellWidth
=
windowWidth
/
numberOfCellsPerRow
;
return
CGSizeMake
(
cellWidth
,
cellWidth
*
aspectRatio
);
}
-
(
UIEdgeInsets
)
collectionView
:(
UICollectionView
*
)
collectionView
layout
:(
UICollectionViewLayout
*
)
collectionViewLayout
insetForSectionAtIndex
:(
NSInteger
)
section
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment