Marino Faggiana 6 жил өмнө
parent
commit
c0028f0a96

+ 6 - 8
iOSClient/Main/Create cloud/NCCreateFormUploadRichdocuments.storyboard

@@ -24,15 +24,15 @@
                                 <constraints>
                                     <constraint firstAttribute="height" constant="200" id="XAH-EC-bwE"/>
                                 </constraints>
-                                <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="5" minimumInteritemSpacing="5" id="pay-52-Gt0">
+                                <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="pay-52-Gt0">
                                     <size key="itemSize" width="150" height="165"/>
                                     <size key="headerReferenceSize" width="0.0" height="0.0"/>
                                     <size key="footerReferenceSize" width="0.0" height="0.0"/>
-                                    <inset key="sectionInset" minX="5" minY="5" maxX="5" maxY="0.0"/>
+                                    <inset key="sectionInset" minX="10" minY="10" maxX="9" maxY="0.0"/>
                                 </collectionViewFlowLayout>
                                 <cells>
                                     <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="cell" id="3Zg-hF-dVr">
-                                        <rect key="frame" x="5" y="5" width="150" height="165"/>
+                                        <rect key="frame" x="10" y="10" width="150" height="165"/>
                                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
                                         <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
                                             <rect key="frame" x="0.0" y="0.0" width="150" height="165"/>
@@ -41,9 +41,6 @@
                                                 <imageView opaque="NO" userInteractionEnabled="NO" tag="100" contentMode="scaleAspectFit" translatesAutoresizingMaskIntoConstraints="NO" id="X31-eH-dH5" userLabel="ImagePreview">
                                                     <rect key="frame" x="1" y="1" width="148" height="148"/>
                                                     <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                                    <constraints>
-                                                        <constraint firstAttribute="height" constant="148" id="BG3-vx-4j8"/>
-                                                    </constraints>
                                                 </imageView>
                                                 <label opaque="NO" userInteractionEnabled="NO" tag="200" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BeG-go-HP6">
                                                     <rect key="frame" x="0.0" y="150" width="150" height="15"/>
@@ -66,13 +63,14 @@
                                         </view>
                                         <color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                         <constraints>
-                                            <constraint firstItem="Byg-Ok-yCr" firstAttribute="centerY" secondItem="X31-eH-dH5" secondAttribute="centerY" id="5Nv-Dp-EhZ"/>
+                                            <constraint firstItem="BeG-go-HP6" firstAttribute="top" secondItem="X31-eH-dH5" secondAttribute="bottom" constant="1" id="67E-L2-y86"/>
                                             <constraint firstItem="BeG-go-HP6" firstAttribute="leading" secondItem="3Zg-hF-dVr" secondAttribute="leading" id="9aq-dC-p0W"/>
-                                            <constraint firstItem="Byg-Ok-yCr" firstAttribute="centerX" secondItem="X31-eH-dH5" secondAttribute="centerX" id="FBh-By-cXv"/>
+                                            <constraint firstItem="Byg-Ok-yCr" firstAttribute="centerX" secondItem="X31-eH-dH5" secondAttribute="centerX" id="CEc-hq-24i"/>
                                             <constraint firstItem="X31-eH-dH5" firstAttribute="leading" secondItem="3Zg-hF-dVr" secondAttribute="leading" constant="1" id="HCI-EG-bNi"/>
                                             <constraint firstAttribute="trailing" secondItem="BeG-go-HP6" secondAttribute="trailing" id="Ir1-IG-qyG"/>
                                             <constraint firstAttribute="trailing" secondItem="X31-eH-dH5" secondAttribute="trailing" constant="1" id="OsG-61-SBl"/>
                                             <constraint firstItem="X31-eH-dH5" firstAttribute="top" secondItem="3Zg-hF-dVr" secondAttribute="top" constant="1" id="jik-qq-poj"/>
+                                            <constraint firstItem="Byg-Ok-yCr" firstAttribute="centerY" secondItem="X31-eH-dH5" secondAttribute="centerY" id="kKZ-cS-fa6"/>
                                             <constraint firstAttribute="bottom" secondItem="BeG-go-HP6" secondAttribute="bottom" id="qCU-fe-CS8"/>
                                         </constraints>
                                     </collectionViewCell>

+ 12 - 1
iOSClient/Main/Create cloud/NCCreateFormUploadRichdocuments.swift

@@ -25,7 +25,7 @@ import Foundation
 
 // MARK: -
 
-class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, UICollectionViewDataSource, UICollectionViewDelegate {
+class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
     
     var typeTemplate = ""
     var serverUrl = ""
@@ -125,6 +125,17 @@ class NCCreateFormUploadRichdocuments: XLFormViewController, NCSelectDelegate, U
         return listOfTemplate.count
     }
     
+    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
+
+        let numItems = 2
+        let sectionInsets: CGFloat = 10
+        
+        let itemWidth: CGFloat = (collectionView.frame.width - (sectionInsets * 4) - CGFloat(numItems)) / CGFloat(numItems)
+        let itemHeight: CGFloat = itemWidth + 15
+        
+        return CGSize(width: itemWidth, height: itemHeight)
+    }
+    
     func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
         
         let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)