Browse Source

popup - coding

marinofaggiana 4 years ago
parent
commit
f300a4f4f8

+ 3 - 9
iOSClient/Main/Menu/NCCollectionViewCommon+Menu.swift

@@ -228,15 +228,9 @@ extension NCCollectionViewCommon {
                             
                             viewController.metadata = metadata
 
-                            let popupVC = NCPopupViewController(contentController: viewController, popupWidth: 300, popupHeight: 400)
-                            
-                            popupVC.backgroundAlpha = 0.3
-                            popupVC.backgroundColor = .black
-                            popupVC.canTapOutsideToDismiss = true
-                            popupVC.cornerRadius = 10
-                            popupVC.shadowEnabled = true
-                            
-                            self.present(popupVC, animated: true)
+                            let popup = NCPopupViewController(contentController: viewController, popupWidth: 300, popupHeight: 400)
+                                                        
+                            self.present(popup, animated: true)
                         }
                     }
                 )

+ 21 - 11
iOSClient/Main/Rename file/NCRenameFile.storyboard

@@ -18,27 +18,27 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ouH-gK-Guv" userLabel="Separator">
-                                <rect key="frame" x="0.0" y="105" width="414" height="1"/>
+                                <rect key="frame" x="0.0" y="102" width="414" height="1"/>
                                 <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="1" id="2OQ-Mt-Gnh"/>
                                 </constraints>
                             </view>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rename" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nZr-nE-ths">
-                                <rect key="frame" x="20" y="64" width="374" height="21"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <rect key="frame" x="20" y="64" width="374" height="18"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="15"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="t26-3S-4T4">
-                                <rect key="frame" x="132" y="121" width="150" height="150"/>
+                                <rect key="frame" x="132" y="118" width="150" height="150"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="150" id="PaU-P7-coi"/>
                                     <constraint firstAttribute="height" constant="150" id="s6R-ay-3Ui"/>
                                 </constraints>
                             </imageView>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FOZ-fs-k7i">
-                                <rect key="frame" x="324" y="307.5" width="10" height="21"/>
+                                <rect key="frame" x="324" y="304.5" width="10" height="21"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="10" id="T5K-dj-AdT"/>
                                 </constraints>
@@ -47,27 +47,37 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Ny2-wR-rxo">
-                                <rect key="frame" x="20" y="301" width="304" height="34"/>
-                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <rect key="frame" x="20" y="298" width="304" height="34"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                 <textInputTraits key="textInputTraits"/>
                             </textField>
                             <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Q9G-gl-Fkc">
-                                <rect key="frame" x="334" y="301" width="60" height="34"/>
+                                <rect key="frame" x="334" y="298" width="60" height="34"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="60" id="6ga-cj-dYT"/>
                                 </constraints>
-                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="13"/>
                                 <textInputTraits key="textInputTraits"/>
                             </textField>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="W5y-aT-UlI">
-                                <rect key="frame" x="20" y="370" width="48" height="30"/>
+                                <rect key="frame" x="20" y="367" width="100" height="30"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="30" id="APQ-0x-b1G"/>
+                                    <constraint firstAttribute="width" constant="100" id="Amv-Gj-xDj"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <state key="normal" title="Cancel"/>
                                 <connections>
                                     <action selector="cancel:" destination="V0q-CP-xMJ" eventType="touchUpInside" id="2u6-re-dJy"/>
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hcV-V0-eZB">
-                                <rect key="frame" x="338" y="370" width="56" height="30"/>
+                                <rect key="frame" x="294" y="367" width="100" height="30"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="100" id="abh-UJ-Zsz"/>
+                                    <constraint firstAttribute="height" constant="30" id="dF9-Gh-Ypm"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <state key="normal" title="Rename"/>
                                 <connections>
                                     <action selector="rename:" destination="V0q-CP-xMJ" eventType="touchUpInside" id="9tx-AQ-q6X"/>

+ 27 - 0
iOSClient/Main/Rename file/NCRenameFile.swift

@@ -59,6 +59,33 @@ class NCRenameFile: UIViewController {
                 
         titleLabel.text = NSLocalizedString("_rename_file_", comment: "")
         separatorHeightContraint.constant = 0.3
+        
+        cancelButton.setTitle(NSLocalizedString("_cancel_", comment: ""), for: .normal)
+        cancelButton.setTitleColor(.white, for: .normal)
+        cancelButton.layer.cornerRadius = 15
+        cancelButton.layer.masksToBounds = true
+        cancelButton.layer.backgroundColor = UIColor.gray.cgColor
+        
+        /*
+        
+         cell.primary.isEnabled = false
+         cell.primary.isHidden = true
+         cell.primary.titleLabel?.font = .systemFont(ofSize: 14)
+         cell.primary.setTitleColor(.white, for: .normal)
+         cell.primary.layer.cornerRadius = 15
+         cell.primary.layer.masksToBounds = true
+         cell.primary.layer.backgroundColor = NCBrandColor.shared.brandElement.cgColor
+         
+         cell.secondary.isEnabled = false
+         cell.secondary.isHidden = true
+         cell.secondary.titleLabel?.font = .systemFont(ofSize: 14)
+         cell.secondary.setTitleColor(.gray, for: .normal)
+         cell.secondary.layer.cornerRadius = 15
+         cell.secondary.layer.masksToBounds = true
+         cell.secondary.layer.backgroundColor = NCBrandColor.shared.graySoft.withAlphaComponent(0.1).cgColor
+         cell.secondary.layer.borderWidth = 0.3
+         cell.secondary.layer.borderColor = UIColor.gray.cgColor
+         */
     }
     
     override func viewDidAppear(_ animated: Bool) {

+ 4 - 4
iOSClient/Utility/NCPopupViewController.swift

@@ -77,8 +77,8 @@ public class NCPopupViewController: UIViewController {
     /// Popup position, default is center
     private(set) public var position: PopupPosition = .center(nil)
     
-    /// Background alpha, default is 0.5
-    public var backgroundAlpha: CGFloat = 0.5
+    /// Background alpha, default is 0.3
+    public var backgroundAlpha: CGFloat = 0.3
     
     /// Background color, default is black
     public var backgroundColor = UIColor.black
@@ -86,8 +86,8 @@ public class NCPopupViewController: UIViewController {
     /// Allow tap outside popup to dismiss, default is true
     public var canTapOutsideToDismiss = true
     
-    /// Corner radius, default is 0 (no rounded corner)
-    public var cornerRadius: CGFloat = 0
+    /// Corner radius, default is 10 (0 no rounded corner)
+    public var cornerRadius: CGFloat = 10
     
     /// Shadow enabled, default is true
     public var shadowEnabled = true