Browse Source

edit text

Marino Faggiana 7 years ago
parent
commit
7515ac0919

+ 23 - 0
iOSClient/Images.xcassets/actionSheetModify.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "actionSheetModify.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "actionSheetModify@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "actionSheetModify@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
iOSClient/Images.xcassets/actionSheetModify.imageset/actionSheetModify.png


BIN
iOSClient/Images.xcassets/actionSheetModify.imageset/actionSheetModify@2x.png


BIN
iOSClient/Images.xcassets/actionSheetModify.imageset/actionSheetModify@3x.png


+ 9 - 2
iOSClient/Text/NCText.storyboard

@@ -37,6 +37,11 @@
                         </constraints>
                     </view>
                     <toolbarItems>
+                        <barButtonItem image="actionSheetModify" id="EDN-Il-Q37">
+                            <connections>
+                                <action selector="modifyButtonTapped:" destination="oRF-nm-GrS" id="Vh4-tN-fXC"/>
+                            </connections>
+                        </barButtonItem>
                         <barButtonItem style="plain" systemItem="flexibleSpace" id="7D3-Jp-G8Q"/>
                         <barButtonItem image="actionSheetDelete" id="40X-Vo-Hy2">
                             <connections>
@@ -71,6 +76,7 @@
                     <connections>
                         <outlet property="cancelButton" destination="brk-EO-iNZ" id="8gM-f2-AtV"/>
                         <outlet property="deleteButton" destination="40X-Vo-Hy2" id="0ru-ri-tqi"/>
+                        <outlet property="modifyButton" destination="EDN-Il-Q37" id="0yP-N0-ObG"/>
                         <outlet property="nextButton" destination="Hyb-2c-5Hb" id="Zmo-Th-UUq"/>
                         <outlet property="openInButton" destination="2Kw-LQ-ehq" id="aS5-0P-URL"/>
                         <outlet property="shareButton" destination="6og-yq-pNL" id="s0f-fp-NLP"/>
@@ -79,7 +85,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="r2i-QZ-Y8W" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="785" y="-68"/>
+            <point key="canvasLocation" x="1042" y="-197"/>
         </scene>
         <!--Navigation Controller-->
         <scene sceneID="lyP-Qo-Lgl">
@@ -101,11 +107,12 @@
                 </navigationController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="jdZ-ZN-JEs" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="5" y="-67"/>
+            <point key="canvasLocation" x="10" y="-197"/>
         </scene>
     </scenes>
     <resources>
         <image name="actionSheetDelete" width="25" height="25"/>
+        <image name="actionSheetModify" width="25" height="25"/>
         <image name="actionSheetOpenIn" width="25" height="25"/>
         <image name="actionSheetShare" width="25" height="25"/>
     </resources>

+ 15 - 2
iOSClient/Text/NCText.swift

@@ -14,6 +14,7 @@ class NCText: UIViewController, UITextViewDelegate {
     @IBOutlet weak var nextButton: UIBarButtonItem!
     @IBOutlet weak var textView: UITextView!
     
+    @IBOutlet weak var modifyButton: UIBarButtonItem!
     @IBOutlet weak var openInButton: UIBarButtonItem!
     @IBOutlet weak var shareButton: UIBarButtonItem!
     @IBOutlet weak var deleteButton: UIBarButtonItem!
@@ -46,22 +47,29 @@ class NCText: UIViewController, UITextViewDelegate {
 
         super.viewWillAppear(animated)
         
-        textView.becomeFirstResponder()
-        
         if let fileName = fileName {
+            
             let path = "\(appDelegate.directoryUser!)/\(fileName)"
             loadText = try? String(contentsOfFile: path, encoding: String.Encoding.utf8)
             if loadText == nil {
                 loadText = ""
             }
+            textView.isUserInteractionEnabled = false
+
         } else {
+            
             self.fileName =  NSLocalizedString("_untitled_txt_", comment: "")
+            modifyButton.tintColor = UIColor.clear
+            modifyButton = nil
             openInButton.tintColor = UIColor.clear
             openInButton = nil
             shareButton.tintColor = UIColor.clear
             shareButton = nil
             deleteButton.tintColor = UIColor.clear
             deleteButton = nil
+            
+            textView.isUserInteractionEnabled = true
+            textView.becomeFirstResponder()
         }
     }
     
@@ -102,6 +110,11 @@ class NCText: UIViewController, UITextViewDelegate {
         })
     }
     
+    @IBAction func modifyButtonTapped(_ sender: AnyObject) {
+        textView.isUserInteractionEnabled = true
+        textView.becomeFirstResponder()
+    }
+    
     @IBAction func openInButtonTapped(_ sender: AnyObject) {
         
     }