marinofaggiana 4 years ago
parent
commit
f82c9e8b10
1 changed files with 3 additions and 7 deletions
  1. 3 7
      iOSClient/Viewer/NCViewerPeekPop.swift

+ 3 - 7
iOSClient/Viewer/NCViewerPeekPop.swift

@@ -40,15 +40,16 @@ class NCViewerPeekPop: UIViewController  {
 
         imageView.clipsToBounds = true
         imageView.contentMode = .scaleAspectFill
-        imageView.backgroundColor = .clear
                 
         if metadata.directory {
 
             imageView.image = UIImage(named: "folder")!.image(color: NCBrandColor.shared.brandElement, size: standardSizeWidth)
+            if let image = imageView.image { preferredContentSize = CGSize(width: image.size.width,  height: image.size.height) }
 
         } else {
             
             imageView.image = UIImage.init(named: metadata.iconName)?.resizeImage(size: CGSize(width: standardSizeWidth, height: standardSizeHeight), isAspectRation: true)
+            if let image = imageView.image { preferredContentSize = CGSize(width: image.size.width,  height: image.size.height) }
         
             if metadata.hasPreview {
                 
@@ -56,6 +57,7 @@ class NCViewerPeekPop: UIViewController  {
                     
                     if let image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStoragePreviewOcId(metadata.ocId, etag: metadata.etag)) {
                         imageView.image = image.resizeImage(size: CGSize(width: view.frame.size.width, height: view.frame.size.height), isAspectRation: true)
+                        if let image = imageView.image { preferredContentSize = CGSize(width: image.size.width,  height: image.size.height-50) } // -50 white line bottom
                     }
                     
                 } else {
@@ -75,12 +77,6 @@ class NCViewerPeekPop: UIViewController  {
                 }
             }
         }
-        
-        if let image = imageView.image {
-            preferredContentSize = CGSize(width: image.size.width,  height: image.size.height-50) // -50 white line bottom
-        }
-        
-        view.backgroundColor = .clear
     }
 
     required init?(coder: NSCoder) {