Browse Source

added lock title image for the e2ee folder

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 years ago
parent
commit
0469b88b1d
1 changed files with 12 additions and 5 deletions
  1. 12 5
      iOSClient/Main/Collection Common/NCSelectableNavigationView.swift

+ 12 - 5
iOSClient/Main/Collection Common/NCSelectableNavigationView.swift

@@ -86,13 +86,17 @@ extension NCSelectableNavigationView {
         collectionView.reloadData()
     }
 
-    func createViewImageAndText(image: UIImage, title: String) -> UIView {
+    func createViewImageAndText(image: UIImage, title: String? = nil) -> UIView {
 
         let imageView = UIImageView()
         let titleView = UIView()
         let label = UILabel()
 
-        label.text = title + " "
+        if let title = title {
+            label.text = title + " "
+        } else {
+            label.text = " "
+        }
         label.sizeToFit()
         label.center = titleView.center
         label.textAlignment = NSTextAlignment.center
@@ -105,12 +109,15 @@ extension NCSelectableNavigationView {
         let imageWidth = label.frame.size.height * imageAspect
         let imageHeight = label.frame.size.height
 
-        imageView.frame = CGRect(x: imageX, y: imageY, width: imageWidth, height: imageHeight)
+        if title != nil {
+            imageView.frame = CGRect(x: imageX, y: imageY, width: imageWidth, height: imageHeight)
+            titleView.addSubview(label)
+        } else {
+            imageView.frame = CGRect(x: imageX / 2, y: imageY, width: imageWidth, height: imageHeight)
+        }
         imageView.contentMode = UIView.ContentMode.scaleAspectFit
 
-        titleView.addSubview(label)
         titleView.addSubview(imageView)
-
         titleView.sizeToFit()
 
         return titleView