mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-14 17:23:25 +01:00
Supports both iPhone + iPad screenshots
Prefers showing screenshots for current device, but falls back to all screenshots if there are no relevant ones.
This commit is contained in:
@@ -93,6 +93,25 @@ class AppScreenshotCollectionViewCell: UICollectionViewCell
|
||||
}
|
||||
}
|
||||
|
||||
extension AppScreenshotCollectionViewCell
|
||||
{
|
||||
func setImage(_ image: UIImage?)
|
||||
{
|
||||
guard var image, let cgImage = image.cgImage else {
|
||||
self.imageView.image = image
|
||||
return
|
||||
}
|
||||
|
||||
if image.size.width > image.size.height && self.aspectRatio.width < self.aspectRatio.height
|
||||
{
|
||||
// Image is landscape, but cell has portrait aspect ratio, so rotate image to match.
|
||||
image = UIImage(cgImage: cgImage, scale: image.scale, orientation: .right)
|
||||
}
|
||||
|
||||
self.imageView.image = image
|
||||
}
|
||||
}
|
||||
|
||||
private extension AppScreenshotCollectionViewCell
|
||||
{
|
||||
func updateAspectRatio()
|
||||
|
||||
Reference in New Issue
Block a user